Selenium IDE: executing a test within a test
I have written a test using selenium IDE (with flow control extensions) that iterates through elements within 2 drop-down lists (using 2 loops) and populates a data entry form according to the elements selected in the drop-down lists.
Esstially t开发者_Python百科he form is different for each iteration, rather than using flow control to handle this in one test (making the test extremely large). Would it possible to cover this functionallty in another test executed from within the loop?
Can this be done in Selenium IDE?
If it can be done, can you point toward any online examples/tutorials?
Thank you for your time
David
The Selenium IDE is a pretty simple tool. You want to encapsulate of your test for reuse in other tests? And you want to use loops and flow control?
It sounds like you're ready to graduate to a real programming language.
Export your tests to java or ruby or whatever language you like. Then you can use the flow control and object orientation of the programming language to solve your problems. That will be easier than trying to figure out how to make it work in the IDE. Plus your tests will be more maintainable.
http://seleniumhq.org/docs/05_selenium_rc.html#from-selenese-to-a-program
http://seleniumhq.org/docs/06_test_design_considerations.html#page-object-design-pattern
Here is an extension that adds full-fledged looping, conditional execution, and callable functions to Selenium IDE: SelBlocks
You setup a script/endScript section in your test, and then call it with parameters. For example:
call|fillform|name="dilbert",phone="555-1212"
call|fillform|name="wally",phone='unlisted"
script|fillform
type|name|${name}
type|phone|${phone}
endScript
(String values are quoted because parameters are regular javascript expressions.)
精彩评论