Package play.test
Class WithServer
java.lang.Object
play.test.WithServer
- Direct Known Subclasses:
WithBrowser
Provides a server to JUnit tests. Make your test class extend this class and an HTTP server will
be started before each test is invoked. You can setup the application and port to use by
overriding the provideApplication and providePort methods. Within a test, the running application
and the TCP port are available through the app and port fields, respectively.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ApplicationOverride this method to setup the application to use.protected intOverride this method to setup the port to use.voidvoid
-
Field Details
-
app
-
port
protected int port -
testServer
-
-
Constructor Details
-
WithServer
public WithServer()
-
-
Method Details
-
provideApplication
Override this method to setup the application to use.- Returns:
- The application used by the server
-
providePort
protected int providePort()Override this method to setup the port to use.- Returns:
- The TCP port used by the server
-
startServer
public void startServer() -
stopServer
public void stopServer()
-