JUNIT5 中将添加哪些属性来自动运行测试? 我该如何配置?
您应该使用 maven-surefire-plugin,例如:
<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>
然后,如果您运行
mvn test
,您的代码将被编译并运行测试。
您可以使用 Maven 插件:
<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>
有关更多信息,请参阅文档。
如何在修改代码时自动运行测试?