[英]Is the maven surefire plugin needed to run unit tests?
Is the maven surefire plugin needed to run unit tests when using the mvn clean test
command? 使用
mvn clean test
命令时,是否需要maven surefire插件来运行单元测试?
I read the documentation and know it says that: 我阅读了文档并知道它说:
The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application.
Surefire插件在构建生命周期的测试阶段使用,以执行应用程序的单元测试。 It generates reports in two different file formats:
它以两种不同的文件格式生成报告:
Plain text files ( .txt) XML files ( .xml) By default, these files are generated at ${basedir}/target/surefire-reports.
纯文本文件( .txt)XML文件( .xml)默认情况下,这些文件是在$ {basedir} / target / surefire-reports处生成的。
However, I ran the tests without using the surefire plugin and they all passed. 但是,我在没有使用surefire插件的情况下运行测试,它们都通过了。
no not needed but it is used by maven per default. 不需要,但maven默认使用它。 if you have a better plugin you can change it.
如果你有一个更好的插件,你可以改变它。 but i would prefer the defaults.
但我更喜欢默认值。
the maven-surfire-plugin is bound to the test phase of the default lifecycle. maven-surfire-plugin绑定到默认生命周期的测试阶段。 the maven-surfire-plugins runs all Tests matches the filename pattern Test*.java, *Test.java und *TestCase.java reside in the directory src/test/java .
maven-surfire-plugins运行所有测试匹配文件名模式Test * .java,* Test.java和* TestCase.java驻留在目录src / test / java中 。
for more information have a look at http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html 欲了解更多信息,请访问http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html
you can verify this on the console output... here is the tailed output of mvn test ...: 你可以在控制台输出上验证这个...这里是mvn test ...的尾输出:
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rechnungsverwaltung ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rechnungsverwaltung ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.447 s
[INFO] Finished at: 2015-10-17T22:36:59+02:00
[INFO] Final Memory: 18M/304M
[INFO] ------------------------------------------------------------------------
Hava a look at the line. 哈瓦一看就行了。 there you can see that the maven-surefire-plugin is used
在那里你可以看到使用了maven-surefire-plugin
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.