July 2018
Intermediate to advanced
116 pages
2h 41m
English
Let's look at the next test framework, which is called Test Containers. We need to add the following two dependencies to activate the Test Containers framework:
<dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers</artifactId> <version>1.5.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.25</version> <scope>test</scope> </dependency>
The idea behind Test Containers is really simple. Since we're going to deploy our web service in a Docker container anyway, why not use a Docker container during our test as well? All you need to add is a @ClassRule. We create GenericContainer, we pass it to a Dockerfile, we pass ...