-
Notifications
You must be signed in to change notification settings - Fork 13
/
DogsTest.java
32 lines (26 loc) · 1.14 KB
/
DogsTest.java
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
package karate;
import com.intuit.karate.Results;
import com.intuit.karate.Runner;
import io.karatelabs.examples.database.Application;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
class DogsTest {
static final Logger logger = LoggerFactory.getLogger(DogsTest.class);
@Autowired
private ServletWebServerApplicationContext webContext;
@Test
void testFeature() {
int port = webContext.getWebServer().getPort();
logger.debug("server port detected as: {}", port);
Results results = Runner.path("classpath:karate/dogs.feature")
.systemProperty("server.port", port + "")
.parallel(1);
assertEquals(0, results.getFailCount(), results.getErrorMessages());
}
}