I'm coming back to Java world again...
I'm following a tutorial (https://spring.io/guides/gs/spring-boot/) and when I run the tests using mvn test
, none of the tests in HelloControllerIT
are getting run. It seems that only classes that end with 'Test' are considered. I'm sure there is a way to add additional patterns so that HelloControllerIT
is included.
Where can I find more information on this topic?
This seems like a simple thing, so I'm probably not using the right keywords in my search (e.g., 'java spring boot test pattern').
Update
Thanks to Yug Singh's answer, I was able to come up with a solution that I feel good with. I added this to my pom.xml
file and now I can run unit tests separate from integration tests.
I forgot about profiles...
+ <profiles>
+ <profile>
+ <id>integration</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*IT.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
Run unit tests
mvn test
Run integration tests
mvn test -Pintegration
References (StackOverflow):