Reputation: 21
Which properties will be added to run tests automaticlly in JUNIT5? How do I configure this?
Upvotes: 2
Views: 724
Reputation: 2860
You can use a maven plugin for it:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/integration/*ITTest.java</exclude>
</excludes>
</configuration>
</plugin>
for more information see documentation.
Upvotes: 2
Reputation: 622
You should use the maven-surefire-plugin, for example:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx1024M ${additional.test.jvm.args}</argLine>
<excludes>
<exclude>**/*ManagedTest.java</exclude>
</excludes>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
</plugins>
</build>
Then if you run mvn test
your code will be both compiled and the tests will be run.
Upvotes: 3