forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBase.java
More file actions
31 lines (25 loc) · 783 Bytes
/
TestBase.java
File metadata and controls
31 lines (25 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package demo;
import com.intuit.karate.junit4.Karate;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import test.ServerStart;
/**
*
* @author pthomas3
*/
@RunWith(Karate.class)
public abstract class TestBase {
private static ServerStart server;
public static int startServer() throws Exception {
if (server == null) { // keep spring boot side alive for all tests including package 'mock'
server = new ServerStart();
server.start(new String[]{"--server.port=0"}, false);
}
System.setProperty("demo.server.port", server.getPort() + "");
return server.getPort();
}
@BeforeClass
public static void beforeClass() throws Exception {
startServer();
}
}