-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathApiTest.java
More file actions
40 lines (32 loc) · 1.02 KB
/
ApiTest.java
File metadata and controls
40 lines (32 loc) · 1.02 KB
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
32
33
34
35
36
37
38
39
40
package app.api;
import app.App;
import io.karatelabs.core.Runner;
import io.karatelabs.core.SuiteResult;
import io.karatelabs.http.HttpServer;
import io.karatelabs.http.ServerConfig;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class ApiTest {
static HttpServer server;
@BeforeAll
static void beforeAll() {
ServerConfig config = App.serverConfig("src/main/java/app");
server = App.start(config, 0);
}
@AfterAll
static void afterAll() {
if (server != null) {
server.stopAndWait();
}
}
@Test
void testAll() {
SuiteResult result = Runner.path("classpath:app/api")
.tags("~@external")
.systemProperty("serverUrl", "http://localhost:" + server.getPort())
.parallel(1);
assertEquals(0, result.getScenarioFailedCount(), String.join("\n", result.getErrors()));
}
}