public class SeleneseRunner
Usage: [-ff|-ie|-ch] [-d | -debug] [-q | -quiet] [-s <sourceFile>] <baseUrl> <testFile>... -ff | -ie | -ch to specify the browser to be used. Default is FireFox -d | -debug outputs actions being executed and inserts a 5 second delay between each. -q | -quiet means that results are not reported. Exit status of 0 implies all successful -s <sourceFile> approximate java code for JUnit type testing is produced and written to this file. test files must adhere to the standard naming pattern [Test Name].rctest.html
When the SeleneseRunner is used in source generation mode (ie With the -s flag), JUnit test cases are written to the specified output file. If, instead of a filename, a hyphen ("-") is given as the parameter following the flag, then the test cases are written to standard output. The format of the test cases is as JUnit4: @Test annotations are provided and the name of each individual test case is derived from the filename of the Selenese test being decoded. If multiple test cases are decoded in a single run, all of the resulting JUnit tests are written to the same output file.
The JUnit test cases are provided in a "bare bones" manner: The Java code to create a Test Class is not provided. The tests also pre-suppose the existence of a "driver" instance (an implementation of SmartClientWebDriver
correct setup for your desired choice of Browser and system under test).
Please note that the Selenese tests will be executed during processing, even in source generation mode. Any failing statements will result in a comment being inserted into the Java code to record the point of failure. This should assist your Java developers in working with and/or enhancing these tests.
Examples
java -cp filterbuilder.jar:htmlparser.jar:isomorphic_webdriver.jar:json-20080701.jar:junit-4.8.1.jar:sax2.jar:selenium-java-2.31.0.jar:thumbelina.jar:guava-10.0.1.jar:commons-exec-1.1.jar:httpcore-4.2.1.jar:httpclient-4.2.1.jar:commons-logging-1.1.1.jar com.isomorphic.webdriver.SeleneseRunner "http://localhost:48011/isomorphic/system/reference/" ~/dev/cvs/current/isomorphic/smartclient/client/reference/inlineExamples/grids/autofit/autofitRows-1.rctest.html
The return code status can be used to wrap a Selenese test case to run it as a JUnit test case if this is desirable.
java -cp filterbuilder.jar:htmlparser.jar:isomorphic_webdriver.jar:json-20080701.jar:junit-4.8.1.jar:sax2.jar:selenium-java-2.31.0.jar:thumbelina.jar:guava-10.0.1.jar:commons-exec-1.1.jar:httpcore-4.2.1.jar:httpclient-4.2.1.jar:commons-logging-1.1.1.jar com.isomorphic.webdriver.SeleneseRunner -s ~/run.out "http://localhost:48011/isomorphic/system/reference/" ~/dev/cvs/current/isomorphic/smartclient/client/reference/inlineExamples/grids/autofit/autofitRows-1.rctest.html
Resulting in:
@Test public void /home/ianr/dev/cvs/current/isomorphic/smartclient/client/reference/inlineExamples/grids/autofit/autofitRows_1() { driver.open("SmartClient_Explorer.html#autofitRows"); driver.waitForElementClickable(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[14]/col[1]")); driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=1||length=7||classIndex=0||classLength=3||roleIn dex=0||roleLength=3||title=Data%20set%3A%205%20records||scRole=button]/")); driver.waitForElementNotPresent(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[5]/col[1]")); driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=3||length=7||classIndex=1||classLength=3||roleIn dex=1||roleLength=3||title=Data%20set%3A%2010%20records||scRole=button]/")); driver.waitForElementClickable(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[9]/col[1]")); driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=5||length=7||classIndex=2||classLength=3||roleIn dex=2||roleLength=3||title=Data%20set%3A%2015%20records||scRole=button]/")); driver.waitForElementClickable(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[14]/col[1]")); driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=1||length=7||classIndex=0||classLength=3||roleIn dex=0||roleLength=3||title=Data%20set%3A%205%20records||scRole=button]/")); driver.waitForElementNotPresent(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[5]/col[1]")); driver.verifyText(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[4]/col[fieldName=countryName||1]"), "Germany"); }