1 回答
TA贡献1810条经验 获得超5个赞
尝试将 spock 测试放在groovy文件夹下:
源代码
时髦的
SpockTest.groovy
com.jenk...
测试
然后将gmavenplus-plugin(groovy compiler) 和maven-surefire-plugin(test runner) 添加到pom.xml:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
</plugins>
</pluginManagement>
...
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<configuration>
<targetBytecode>1.8</targetBytecode>
<warningLevel>2</warningLevel>
</configuration>
<executions>
<execution>
<goals>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
为了在 Jenkins 上进行调试,以确保更好地触发预期的测试以防止出现故障:
def "one plus one should equal two"() {
expect:
1 + 1 == 3
}
添加回答
举报
