Skip to content

Instantly share code, notes, and snippets.

@DarylWM
Created November 29, 2013 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DarylWM/7701508 to your computer and use it in GitHub Desktop.
Save DarylWM/7701508 to your computer and use it in GitHub Desktop.
import com.google.inject.Inject;
import cucumber.api.java.Before;
import play.test.TestBrowser;
import play.test.TestServer;
import static play.test.Helpers.*;
public class GlobalHooks {
@Inject
private TestBrowser testBrowser;
@Inject
private TestServer testServer;
private static boolean initialised = false;
@Before
public void before() {
if (!initialised) {
start(testServer);
initialised = true;
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
testBrowser.quit();
testServer.stop();
}
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment