Wednesday, October 5, 2011

Selenium Test Cases And Test Suites

Selenese
• Selenium IDE produces tests that are written in a DSL (Domain Specific Language) called Selenese Commands.
• Selenese tests are simple xHTML tables of 3 columns and as many rows that there are steps in your test.
The rule for these commands is:
o A method on the first column: the action to perform
o A locator on the second column: the subject of the method (ie: what element is acted upon)
o A value on the third one: the value to be passed to the method (what to type in a text field for instance)




Pizza Test


Pizza Test
open /
type q pizza
click btnG
assertTextPresent regexp:*pizza*



1. The subject of the command open: the root of the application here
2. q is the locator referring to the text field in which type will write pizza
3. click doesn’t need a second argument, we just click on an element (which locator is btnG)
4. assertTextPresent doesn’t need a locator since it searches on the entire page: we just need what to look for


And the corresponding source below - usually you don’t have to touch it, Selenium IDE will do it for you:
Selenese test-case source.






Test Suites

You can assemble test-cases into a test-suite
• They are also expressed as HTML files
• The test-suite only references test-case files as anchor elements
• The anchors are nested inside a table of 1 column and as many rows as there are test-cases in the test-suite



No comments:

Post a Comment