如何在Jenkins中运行Cucumber JVM测试

问题描述 投票:2回答:2

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

我正在按照步骤运行它:

  1. 创建新作业>选择Maven项目
  2. 提供POM.xml的路径
  3. 添加Post Build Action Cucumber-JVM报告
  4. 保存
  5. 立即建造

执行这些步骤后黄瓜测试没有运行,但Build是成功的。

java maven selenium jenkins
2个回答
1
投票

您的pom.xml应该具有如下脚本编程器。

另外jenkins中的目标和选项应该是-Test = Runner Class 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中运行你的测试。


0
投票

您需要在pom.xml中的以下库

<pluginManagement></pluginManagement>

1

  • org.apache.maven.plugins
  • Maven的编译器插件

2

  • org.apache.maven.plugins
  • Maven的万无一失,插件

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

© www.soinside.com 2019 - 2024. All rights reserved.