我有一个与 Maven 和 Cucumber 集成的 Selenium 自动化框架。我想使用 jenkins 运行我的 cucumber 测试。
我按照以下步骤运行它:
- 创建新作业 > 选择 Maven 项目
- 提供 POM.xml 的路径
- 添加构建后操作 Cucumber-JVM 报告
- 保存
- 立即构建
执行这些步骤后, cucumber 测试未运行,但构建成功。
最佳答案
您的 pom.xml 应该具有如下所示的运行程序脚本。
此外,jenkins 中的目标和选项应该是 -Dtest=Runnerclass test 如果您正在运行单个测试
<profiles>
<profile>
<id>integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<parallel>none</parallel>
<threadCount>1</threadCount>
<disableXmlReport>true</disableXmlReport>
</configuration>
<executions>
<execution>
<id>Runnerclass</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
上述插件中的 id 是您的运行者。 然后你可以在 Jenkins 中运行测试。
关于java - 如何在 Jenkins 中运行 Cucumber JVM 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39553484/