Sunday, June 10, 2007

Running a test case ...

Having written the test scripts for Firefox, this time going to tell how to test Firefox with these scripts. The test scripts can be found here

There is a wiki page in LDTP website which gives quick tips about how to run LDTP test cases.

First quick steps to get LDTP installed . If you have LDTP already installed, then you can skip this.

Installation
Get the source/binary from the downloads section of LDTP web page. Any other dependencies which LDTP might need while installation is libxml2 and libat-spi. (I generally install the debug and dev packages of the above two). After this installation of LDTP shouldn't have any issues :-)

Runner XML
Runner XML files makes testing many test cases one after another in a batch mode easy. A sample runner XML can be found here. A very simple runner XML needed to run a single test case will be like

<ldtp>
<logfileoverwrite>1</logfileoverwrite>
<logfile>log.xml</logfile>
<group>
<script>
<name>verifyaddress-autocomplete.py</name>
<data>firefox.xml</data>
</script>
</group>
</ldtp>

The tags are self explanatory.
You can have any number of script blocks and thereby test any number of test cases one after another. The data tag is not necessary but it is better to have a separate data file.

Test
Well, that's all you have to do. Start Firefox and then

hari@home:~$ ldtprunner run.xml

The above command starts testing the application with the test case provided in the run.xml .

Note :: It is also possible to test simply by giving

hari@home:~$ python verifyaddress-autocomplete.py

But i prefer doing it using runner XML, as that has more features.

There is a complete tutorial for LDTP here. This explains everything needed to write a test script clearly and is worth reading :)

No comments: