public class SeleneseRunner
extends java.lang.Object
Usage: [-ff|-ie|-ch] [-d|-debug] [-q|-quiet] [-p <driverConfigFile>] [-s <sourceFile>] [-j <reportFile>] [<baseUrl>] <suiteFile> | <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 -p <driverConfigFile> Java properties file specifying custom capabilities that will be passed as configuration to the driver constructor. Webdriver-specific environment variables, such as those specifying the driver location, may also be specified to help provide further configuration of WebDriver. -s <sourceFile> approximate Java code for JUnit type testing is produced and written to this file. -j <reportFile> reports results in JUnit XML format; only applicable when a test suite is specified instead of individual test filesIf you provide a baseUrl, your Selenese tests will be run against it. If you supply a sourceFile, SeleneseRunner will write a translation of your tests to it. If neither is provided, your Selenese tests will be executed assuming a baseUrl of "http://localhost", which is only appropriate if your Selenese tests open new pages using absolute URLs. You may either provide a single test suite file, named as [Test Suite Name].html, or one or more Test files, named according to the 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 (as part of a test suite or not) 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 if the baseUrl
argument is provided, 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 "*" com.isomorphic.webdriver.SeleneseRunner "http://localhost:8080" "../../tests/dataTypes-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 "*" com.isomorphic.webdriver.SeleneseRunner -s unitTest.java "http://localhost:8080" "../../tests/dataTypes-1.rctest.html"
Note that providing the URL for conversion to Java is optional. If it's not provided, Java code will still be generated as output, but it won't be executed and won't be commented with any notes about which commands failed or threw exceptions.
Resulting Java:
@Test public void /home/ianr/dev/cvs/current/isomorphic/smartclient/client/reference/inlineExamples/grids/autofit/autofitRows_1() { driver.get("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"); }