|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tapestry5.test.SeleniumLauncher
public class SeleniumLauncher
Base class for launching the Selenium test stack, which consists of an
instance of SeleniumServer, and instance of Selenium RC (the
client), and a web server (by default, an instance of Jetty 7).
This class contains configuration methods to launch the servers (before test) and shut
them down (after test). In addition, the Selenium instance is stored as an attribute of
the ITestContext where it can be pulled out by SeleniumTestCase.
To create selenium tests, include SeleniumLauncher as part of your TestNG configuration and
(optionally) configure properties. Create a subclass of SeleniumTestCase to contain your
tests.
It is rarely necessary to subclass SeleniumLauncher, except if the default Jetty server instance needs to be configured specially (or replaced with an alternate server such as Tomcat or Resin).
To use this as part of a set of tests, you must configure the class inside your testng.xml:
<test name="My Integration Tests">
<!-- parameters go here, if needed -->
<packages>
<!-- list of packages containing test suites goes here -->
</packages>
<classes>
<class name="org.apache.tapestry5.test.SeleniumLauncher"/>
</classes>
</test>
| Constructor Summary | |
|---|---|
SeleniumLauncher()
|
|
| Method Summary | |
|---|---|
void |
cleanup()
Shuts down the stack at the end of the test. |
protected java.lang.Runnable |
launchWebServer(java.lang.String webAppFolder,
java.lang.String contextPath,
int port,
int sslPort)
Invoked from #startup(String, String, int, String, ITestContext) to launch the web
server to be
tested. |
void |
startup(java.lang.String webAppFolder,
java.lang.String contextPath,
int port,
int sslPort,
java.lang.String browserStartCommand,
org.testng.ITestContext testContext,
org.testng.xml.XmlTest xmlTest)
Starts up the servers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SeleniumLauncher()
| Method Detail |
|---|
public void startup(java.lang.String webAppFolder,
java.lang.String contextPath,
int port,
int sslPort,
java.lang.String browserStartCommand,
org.testng.ITestContext testContext,
org.testng.xml.XmlTest xmlTest)
throws java.lang.Exception
tapestry.browser-start-command parameter, to run tests
against multiple browsers.
| Parameter | Name | Default | Description |
|---|---|---|---|
| webAppFolder | tapestry.web-app-folder | src/main/webapp | Location of web application context |
| contextPath | tapestry.context-path | empty string | Context path (defaults to root). As elsewhere, the context path should be blank, or start with a slash (but not end with one). |
| port | tapestry.port | 9090 | Port number for web server to listen to |
| sslPort | tapestry.ssl-port | 8443 | Port number for web server to listen to for secure requests |
| browserStartCommand | tapestry.browser-start-command | *firefox | Command string used to launch the browser, as defined by Selenium |
org.apache.tapestry5.integration.reload.ReloadTests#beforeStartup.
webAppFolder - contextPath - port - browserStartCommand - testContext - Used to share objects between the launcher and the test suites
java.lang.Exceptionpublic void cleanup()
protected java.lang.Runnable launchWebServer(java.lang.String webAppFolder,
java.lang.String contextPath,
int port,
int sslPort)
throws java.lang.Exception
#startup(String, String, int, String, ITestContext) to launch the web
server to be
tested. The return value is a Runnable that will shut down the launched server at the end of
the test (it is coded this way so that the default Jetty web server can be more easily
replaced).
webAppFolder - path to the web application contextcontextPath - the path the context is mapped to, usually the empty stringport - the port number the server should handlesslPort - the port number on which the server should handle secure requests
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||