Created
December 2, 2013 02:22
-
-
Save codingricky/7743981 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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