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
<logfileoverwrite>1</logfileoverwrite>
<logfile>log.xml</logfile>
<group>
<script>
<name>verifyaddress-autocomplete.py</name>
<data>firefox.xml</data>
</script>
</group>
</ldtp>
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 :)
5 comments:
Thanks for the blog post, explaining things.
So if I understand it correctly from the ldtp documentation, it uses gnome accessibility code to call the accessibility code in Firefox to do stuff in Firefox, right?
Could I also get this setup under Ubuntu in VMWare?
I guess the scripts would have to change considerably to get it working for Firefox3?
@martijn : The code i mentioned there was tested for (in fact written using) Firefox 3. And that too in a Ubuntu box :-) (though not under VMWare).
So you need not change much to run the scripts :)
Just write your own runner XML ( that reminds me that even i should write one properly soon ) and start testing :-)
Ok, thanks for the info.
Don't you have problems with the fact that Firefox 3 is a moving target, so the scripts will probably stop working after a while?
Hi Hari,
I have tested you scripts for firefox testing but its showing some error.
[root@localhost firefox]# ldtprunner run.xml
Warning: AT-SPI error: pre method check: add: Unknown CORBA exception id: 'IDL:omg.org/CORBA/COMM_FAILURE:1.0'
Warning: AT-SPI error: pre method check: add: Unknown CORBA exception id: 'IDL:omg.org/CORBA/COMM_FAILURE:1.0'
Warning: AT-SPI error: pre method check: add: Unknown CORBA exception id: 'IDL:omg.org/CORBA/COMM_FAILURE:1.0'
Warning: AT-SPI error: pre method check: add: Unknown CORBA exception id: 'IDL:omg.org/CORBA/COMM_FAILURE:1.0'
Traceback (most recent call last):
File "/usr/bin/ldtprunner", line 611, in module
main ()
File "/usr/bin/ldtprunner", line 604, in main
executeldtp (dom)
File "/usr/bin/ldtprunner", line 173, in executeldtp
executecategories (ldtpelements)
File "/usr/bin/ldtprunner", line 182, in executecategories
executegroup (ldtpelements)
File "/usr/bin/ldtprunner", line 319, in executegroup
scriptPassCount, totalScripts = executescript (groupelements)
File "/usr/bin/ldtprunner", line 481, in executescript
msg = replacequotes.sub ('', msg)
TypeError: expected string or buffer
[root@localhost firefox]# python verifyaddress
verifyaddress-autocomplete.py verifyaddressfield.py
[root@localhost firefox]# python verifyaddress-autocomplete.py
Traceback (most recent call last):
File "verifyaddress-autocomplete.py", line 39, in module
data_object = LdtpDataFileParser (datafilename)
NameError: name 'datafilename' is not defined
[root@localhost firefox]#
Hello,
You have to run the python script using ldtprunner, not through the python interpreter.
Thanks
Post a Comment