There are several reasons to use LiquidTest to run Selenium tests on a server. One compelling reason comes due to base architecture. LiquidTest utilizes deep hooks into the browser (rather than Javascript injection) which produce more consistent and stable test runs than Selenium RC/Server. The LiquidTest Server is developed to be deliberately fault-tolerant and not as timing sensitive as Selenium. Our experience is that many tests that fail in Selenium due to timing complications work without issue in LiquidTest.
This tutorial runs through running Selenium
HTML Test Suites with LiquidTest. If you have Selenium JUnit tests please see our
Integrations page.
Get the liquidtest-nodeps-<version>.jar at least version 3.0
1 - Get a LiquidTest Server license
2 - Create a new file called 'liquidtest.properties' and place the license key within.
The contents of the file should look like the following:
licenseKey=AAAAgF67uGXUl4t....
3 - Create a new JAR file called 'license.jar' containing the liquidtest.properties file as it's sole contents. From the command line you can create a JAR file with the following command:
jar -cf license.jar liquidtest.properties
A Selenium Test Suite describes to the test runner what tests should be executed. A Selenium Test Suite can be as large or small as you wish. For simplicity we will create a Selenium Test Suite (IESuite.html) to run a single Test.
<html>
<head>
<title>My Test Suite</title>
</head>
<body>
<table>
<tr><td><b>Suite Of Tests</b></td></tr>
<tr><td><a href="./Test1.html">Test Example</a></td></tr>
</table>
</body>
</html>
Your tests (described in the Test Suite created above) can be executed from the command line with a few simple parameters. The first parameter is the location you wish for the report to be output to (-report). The second parameter is the location of the Test Suite or Test file. Below is an example of how to execute a Selenium Test Suite from the command line:
java -cp liquidtest-nodeps-3.0.0.jar;C:\license.jar com.jadeliquid.liquidtest.selenium.remote.RemoteSeleniumRunner -report c:\report.xml -test "C:\runtime-New_configuration(2)\LiquidTestProject\src\IESuite.html"
This will run the tests specified without a visible browser window. An XML report is written that contains the test execution results.
After running the test suite above the following test execution report is written in XML.
<testrun tests="8" errors="2" started="2011-03-22 13:44:20.828 EST" time="53765" hostname="foobar">
<testcase name="SeleniumBase.html" fullpath="C:/runtime-New_configuration(2)/LiquidTestProject/src/SeleniumBase.html" browser="MSIE8.0" time="3031" started="2011-03-22 13:44:20.828 EST"/>
<testcase name="NewHtmlRecorder7.html" fullpath="C:/runtime-New_configuration(2)/LiquidTestProject/src/NewHtmlRecorder7.html" browser="Firefox" time="17625" started="2011-03-22 13:44:24.281 EST">
<error line="20" message="No such element to click: '//*[@value='Google Search']/../../../DIV/IN'" type="com.jadeliquid.liquidtest.TestError">com.jadeliquid.liquidtest.TestError: No such element to click: '//*[@value='Google Search']/../../../DIV/IN'
at com.jadeliquid.liquidtest.model.impl.TestBrowserImpl.getNodeOrFail(TestBrowserImpl.java:509)
at com.jadeliquid.liquidtest.model.impl.TestBrowserImpl.clickInternal(TestBrowserImpl.java:535)
at com.jadeliquid.liquidtest.model.impl.TestBrowserImpl.clickWithModifiers(TestBrowserImpl.java:714)
at com.jadeliquid.liquidtest.selenium.SeleniumImpl.click(SeleniumImpl.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.jadeliquid.liquidtest.selenium.runners.SeleniumRunner.executeCommand(SeleniumRunner.java:118)
at com.jadeliquid.liquidtest.selenium.runners.SeleniumRunner.runSingleTest(SeleniumRunner.java:87)
at com.jadeliquid.liquidtest.selenium.runners.SeleniumRunner.run(SeleniumRunner.java:50)
at com.jadeliquid.liquidtest.selenium.remote.RemoteSeleniumRunner.connectAndRun(RemoteSeleniumRunner.java:117)
at com.jadeliquid.liquidtest.selenium.remote.RemoteSeleniumRunner.run(RemoteSeleniumRunner.java:39)
at com.jadeliquid.liquidtest.selenium.remote.RemoteSeleniumRunner.main(RemoteSeleniumRunner.java:31)
</error>
</testcase>
<testcase name="Assert3.html" fullpath="C:/runtime-New_configuration(2)/LiquidTestProject/src/Assert3.html" browser="Firefox" time="1578" row="1" started="2011-03-22 13:44:42.15 EST"/>
<testcase name="Assert3.html" fullpath="C:/runtime-New_configuration(2)/LiquidTestProject/src/Assert3.html" browser="Firefox" time="1078" row="2" started="2011-03-22 13:44:43.687 EST"/>
<testcase name="Assert3.html" fullpath="C:/runtime-New_configuration(2)/LiquidTestProject/src/Assert3.html" browser="Firefox" time="1109" row="3" started="2011-03-22 13:44:44.875 EST"/>
<testcase name="Assert3.html" fullpath="C:/runtime-New_configuration(2)/LiquidTestProject/src/Assert3.html" browser="Firefox" time="1093" row="4" started="2011-03-22 13:44:46.78 EST"/>
<testcase name="IE Google" fullpath="C:/runtime-New_configuration(2)/LiquidTestProject/src/IESuite.html" browser="MSIE8.0" time="9656" started="2011-03-22 13:44:47.265 EST"/>
</testrun>
The following options can be passed to the LiquidTest Selenium Test Runner.
usage: ?
-host <host> the host is written into the report
-port <port> TCP port to connect to and report status
-quiet do not output test run progress
-report <report> xml report file to create
-test <test> selenium test file or suite of tests to run (can specify multiple times)
Note: This article shows how to run Selenium
HTML and Selenium
HTML Test Suites, not JUnit. For steps to run JUnit tests on a server see
here..
|
|
News / Events
|
|
|
|
|
|
|
|
Recently Added Content
|
|
|
|
|