I am writting my tests useing rest-assured and spring-boot.
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ApplicationSErvice.class)
@WebAppConfiguration
@IntegrationTest("server.port:0")//dynamically pick up ports
public class MyTestClass{
@Value("${local.server.port}")
int port;
@Before
public void setup(){
RestAssured.port=port;
}
@Test
public void testMethod(){
//asserting
}
In the log I see it says starting Tomcat on port and STarting service Tomcat but then it fails with this error -
ERROR 8480 --- [cat-startStop-1] org.apache.catalina.core.ContainerBase : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/service]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
For web integration testing, you should use
@WebIntegrationTest
instead.