如何在Jenkins中运行Cucumber JVM测试

时间:2016-09-18 02:29:16

标签: java maven selenium jenkins

我有一个与Maven和Cucumber集成的Selenium Automation Framework。我想用詹金斯进行黄瓜测试。

我正在按照步骤运行它:

  1. 创建新工作>选择Maven Project
  2. 提供POM.xml的路径
  3. 添加Post Build Action Cucumber-JVM报告
  4. 保存
  5. 立即构建
  6. 执行这些步骤后黄瓜测试没有运行,但Build成功。

2 个答案:

答案 0 :(得分:1)

你的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中运行你的测试。

答案 1 :(得分:0)

您需要在pom.xml中的

中包含以下库
<pluginManagement></pluginManagement>

1

  • org.apache.maven.plugins
  • 行家编译-插件

2

  • org.apache.maven.plugins
  • 行家-万无一失-插件

再次构建项目,然后在pom.xml的目录中执行 - “maven clean”,“maven test”