description
add the content of another test to the current test
- target receives the page address (from selenium tests root)
- text receives vars names and their values for this test as a comma separated list of var_name=value
nested include works
selenium IDE users Note :
In selenium IDE you won't be able to play your script in the editing window but you will be able to play them in selenium TestRunner.
example of use
in the test :
| include |
testpiece.html |
name=joe,userId=3445 |
where testpiece.html contains
| this is a piece of test |
|
|
| open |
myurl?userId=${userId} |
|
| verifyTextPresent |
${name} |
|
as selenium reaches the include command, it will load
<location-of-TestSuite.html>/testpiece.html into you current test, replacing ${name} with joe and ${userId} with 3445
and your test will become
| includeExpanded |
testpiece.html |
name=joe,userId=3445 |
| open |
myurl?userId=3445 |
|
| verifyTextPresent |
joe |
|
moreover if you click on the line with "includeExpanded", it will show/hide included lines !
notes
this extension is based upon XMLHttpRequest so your browser as to support it.
license
This user extension is available as part of the public domain.
download
include command v2.3
For older releases use the Attachments tab at the top
Found a bug where the command breaks if testrunner.html is called with querystring parameters. The querystring is not chopped off the baseUrl before appending the include locator. To fix, I made the following change:
//Need to remove possible query string. Eg: testrunner.html?test=myTestSuite.html&auto=true
var docLoc = document.location;
docLoc = docLoc.href.substr(0, docLoc.href.length - docLoc.search.length);
baseUrl = docLoc.match(new RegExp("^(.+/)[^/]+$"))[1] // base uri = char - / - chars other than /