[英]Maven skips JUnit/Spock failed tests run with TestNG
I've a spock test that fails to compile - one of the class fields is attempted to be created by invoking a non-existing constructor. 我有一个无法编译的Spock测试-尝试通过调用不存在的构造函数来创建类字段之一。
When maven-surefire-plugin
tries to run this test on the CI server (jenkins) it results in an exception: 当
maven-surefire-plugin
尝试在CI服务器(jenkins)上运行此测试时,将导致异常:
09:54:59 Failure in JUnit mode for class com.whatever.SomeSpec
.
Caused by: org.spockframework.util.InternalSpockError: Failed to instantiate spec
.
Caused by: java.lang.ExceptionInInitializerError
.
Caused by: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: (...)
Instead of failing the whole build this exception is skipped and build continues. 不会使整个构建失败,而是跳过该异常,并继续构建。 How can I fail the build in such a situation?
在这种情况下如何使构建失败?
pom.xml
conf: pom.xml
conf:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<threadCount>1</threadCount>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*TestCase.java</include>
<include>**/*Spec.class</include>
</includes>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.17</version>
</dependency>
</dependencies>
</plugin>
TestNG is not supported by Spock 1.x, only JUnit4. Spock 1.x仅JUnit4不支持TestNG。 Spock 2.x will require the JUnit Platform.
Spock 2.x将需要JUnit平台。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.