Confirmed users
683
edits
| Line 15: | Line 15: | ||
=== Scripts running from a web browser === | === Scripts running from a web browser === | ||
Till Bugzilla 3.0.x, Selenium tests were all written in HTML. It has been decided for Bugzilla 3.2 RC1 and newer to convert them to Perl, giving us more flexibility and control. We no longer write test scripts in HTML. | |||
[http://openqa.org/selenium-ide/ selenium-IDE] ([https://addons.mozilla.org/extensions/moreinfo.php?application=firefox&category=Newest&numpg=10&id=2079 amo], formerly [http://seleniumrecorder.mozdev.org/ Selenium Recorder]) is a Firefox extension which writes scripts for you. It records your actions and converts them into a valid Selenium script. If you decide to install this extension, you don't need to install Selenium separately; everything is included in the XPI package (samples and docs are not included though). | === Perl Selenium scripts === | ||
The fastest way to write Selenium scripts is to use [http://openqa.org/selenium-ide/ selenium-IDE] ([https://addons.mozilla.org/extensions/moreinfo.php?application=firefox&category=Newest&numpg=10&id=2079 amo], formerly [http://seleniumrecorder.mozdev.org/ Selenium Recorder]). Selenium-IDE is a Firefox extension which writes scripts for you. It records your actions and converts them into a valid Selenium script. If you decide to install this extension, you don't need to install Selenium separately; everything is included in the XPI package (samples and docs are not included though). You can also write Selenium scripts with a text editor, but this is longer and can be pretty painful. | |||
In order to run these Perl scripts, you first have to install 2 Perl modules, both of which are available on CPAN: | |||
[http://search.cpan.org/~lukec/Alien-SeleniumRC/ Alien::SeleniumRC] | |||
[http://search.cpan.org/~lukec/Test-WWW-Selenium/ Test::WWW::Selenium] | |||
Each command is then of the form $sel->command_name_ok('field', 'value', 'description'), where $sel is the test object created by Test::WWW::Selenium and which will do the interface between your test script and your Bugzilla installation. The description is optional, but gives very useful information. A typical output is of the form: | |||
#perl test_enter_new_bug.t | |||
ok 1 - open, /bugzilla/ | |||
ok 2 - Enter admin login name | |||
ok 3 - Enter admin password | |||
ok 4 - Submit credentials | |||
ok 5 - open, /bugzilla/enter_bug.cgi?product=TestProduct | |||
ok 6 - Display enter_bug.cgi for the selected product (bypass classifications) | |||
ok 7 - Enter bug summary | |||
ok 8 - Enter bug description | |||
ok 9 - Submit bug data to post_bug.cgi | |||
ok 10 - Bug created | |||
1..10 | |||
What you can read here are the descriptions given for each command of the script. This makes debugging much easier! | |||
Existing Selenium scripts can be found in bugs depending on [http://landfill.bugzilla.org/bugzillaqa/show_bug.cgi?id=3065 bug 3065]. Members of the QA team can use CVS to get them all at once using: | |||
cvs -d my_login@landfill.bugzilla.org:/cvsroot co selenium | |||
where my_login is your user account name on landfill. | |||
[[category:Bugzilla|QA]] | [[category:Bugzilla|QA]] | ||
[http://www.bugzilla.jp/bzwiki/bz/Bugzilla:QA Ja] | [http://www.bugzilla.jp/bzwiki/bz/Bugzilla:QA Ja] | ||