To do a chain test over a several micro services components I want to start multiple microservices (created using Spring Boot) before running the tests.
Root
|
+ microservice A
|
+ microservice B
|
+ microservice C
|
+ integration tests
I tried to run 'spring-boot:start' multiple times in the pre-integration-test phase from the integration test module, but I could not get this working. So I do have two questions:
It took some time, but I got it working using the following plugin settings
<plugin>
<groupId>com.bazaarvoice.maven.plugins</groupId>
<artifactId>process-exec-maven-plugin</artifactId>
<version>0.7</version>
<executions>
<execution>
<id>frontend</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<name>run-server</name>
<waitForInterrupt>false</waitForInterrupt>
<healthcheckUrl>http://localhost:8082/actuator/health</healthcheckUrl>
<arguments>
<argument>java</argument>
<argument>-jar</argument>
<argument>${project.build.directory}/frontend.jar</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>frontend2</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<name>run-server</name>
<waitForInterrupt>false</waitForInterrupt>
<healthcheckUrl>http://localhost:8083/actuator/health</healthcheckUrl>
<arguments>
<argument>java</argument>
<argument>-jar</argument>
<argument>${project.build.directory}/frontend2.jar</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>backendservice</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<name>run-server</name>
<waitForInterrupt>false</waitForInterrupt>
<healthcheckUrl>http://localhost:8081/actuator/health</healthcheckUrl>
<arguments>
<argument>java</argument>
<argument>-jar</argument>
<argument>${project.build.directory}/backendservice.jar</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>stop-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-all</goal>
</goals>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With