Categorizing tests

It also makes sense to separate integration tests in the CI pipeline so that external outages don't block or break the build of the project. You should consider categorizing your tests by annotating them with @Category. You may create the interface especially for integration tests, for example, IntegrationTest:

public interface IntegrationTest  { }

Then, you can mark your test with that interface using the @Category annotation:

@Category(IntegrationTest.class)public class OrderIntegrationTest { ... }

Finally, you can configure Maven to run only the selected type of tests, for example, with maven-failsafe-plugin:

<plugin>  <artifactId>maven-failsafe-plugin</artifactId>  <dependencies>    <dependency> <groupId>org.apache.maven.surefire</groupId> ...

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.