【发布时间】:2019-01-27 21:08:00
【问题描述】:
我创建了包含 junit 和 spock 测试的 maven 项目。 两个测试的代码。
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
class SpockTest extends Specification {
def "one plus one should equal two"() {
expect:
1 + 1 == 2
}
}
在我的本地机器上运行 mvn test 时,它会检测两个测试类。
我在 git 存储库上部署了项目,并为 maven 项目配置了 jenkins。我推送存储库并为此项目执行作业,但是 jenkins 仅检测到 JUnit 测试的 AppTest 类。
我已更改 pom.xml 并将文件 regadring 添加到 https://github.com/menonvarun/testInProgress-spock-client。
我的项目结构。
文件 org.spockframework.runtime.extension.IGlobalExtension 的内容
org.imaginea.jenkins.testinprogress.spock.SpockTestInProgressExtension
pom.xml
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.imaginea.jenkins.plugins</groupId>
<artifactId>testInProgress-spock-client</artifactId>
<version>0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
我在 jenkins 平台上安装了 testInProgress 插件。之后,我将更改的 maven 项目推送到存储库并再次执行 maven 项目的作业。还有一次詹金斯没有检测到 SpockTest 类。可能是什么问题?
【问题讨论】: