如何在jenkins中重新运行Cucumber-jvm的失败测试用例 [英] How rerun failed test cases of cucumber-jvm in jenkins

查看:167
本文介绍了如何在jenkins中重新运行Cucumber-jvm的失败测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在jenkins中重新运行Cucumber-jvm失败的测试用例?

How to rerun failed test cases of cucumber-jvm in jenkins?

根据此主题中提到的答案: 如何在黄瓜jvm中重新运行失败的测试用例?

According to answers mentioned in this thread: How to rerun failed test cases in cucumber-jvm?

有不同的maven命令来移动和运行rerun.txt的方案.如何在Jenkins中使用单独的maven命令执行它们以重新运行?

There is different maven command to move and run scenarios for rerun.txt. How to execute them in Jenkins with separate maven command for rerun?

推荐答案

我使用框架,该框架使用

浏览器驱动程序,具有:

This does not relate to your question, but I manage all my selenium browser drivers with:

                    <!-- docs: https://ardesco.lazerycode.com/testing/webdriver/2012/08/12/introducing-the-driver-binary-downloader-maven-plugin-for-selenium.html -->
                    <plugin>
                            <groupId>com.lazerycode.selenium</groupId>
                            <artifactId>driver-binary-downloader-maven-plugin</artifactId>
                            <version>${driver-binary-downloader.plugin.version}</version>
                            <configuration>
                                    <rootStandaloneServerDirectory>${project.basedir}/selenium/bin</rootStandaloneServerDirectory>
                                    <downloadedZipFileDirectory>${project.basedir}/selenium/zip</downloadedZipFileDirectory>
                                    <customRepositoryMap>${project.basedir}/RepositoryMap.xml</customRepositoryMap>
                                    <overwriteFilesThatExist>true</overwriteFilesThatExist>
                            </configuration>
                            <executions>
                                    <execution>
                                            <phase>pre-integration-test</phase>
                                            <goals>
                                                    <goal>selenium</goal>
                                            </goals>
                                    </execution>
                            </executions>
                    </plugin>

我使用 failsafe-plugin 来运行集成测试:

I use the failsafe-plugin to run my integration tests:

                    <!-- integration tests: run everything named *IT -->
                    <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-failsafe-plugin</artifactId>
                            <version>${surefire.plugin.version}</version>
                            <configuration>
                                    <systemPropertyVariables>
                                            <!-- set by driver-binary-downloader-maven-plugin -->
                                            <webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
                                            <webdriver.gecko.driver>${webdriver.gecko.driver}</webdriver.gecko.driver>
                                    </systemPropertyVariables>
                            </configuration>
                            <executions>
                                    <execution>
                                            <goals>
                                                    <goal>integration-test</goal>
                                                    <goal>verify</goal>
                                            </goals>
                                    </execution>
                            </executions>
                    </plugin>
            </plugins>
    </build>

以上内容将重新运行任何失败的测试,这是在计算机上本地运行内容时可能想要的.

The above will not rerun any failed tests, which is what you probably want when you run stuff locally on your machine.

仅在Jenkins上,我重新启动失败的测试:

On Jenkins only, I turn on the rerunning of failed tests:

    <profiles>
            <profile>
                    <id>jenkins</id>
                    <activation>
                            <property>
                                    <name>env.JENKINS_HOME</name>
                            </property>
                    </activation>
                    <build>
                            <plugins>
                                    <plugin>
                                            <artifactId>maven-failsafe-plugin</artifactId>
                                            <dependencies>
                                                    <!-- docs: https://maven.apache.org/surefire/maven-failsafe-plugin/examples/rerun-failing-tests.html#Re-run_execution_in_Cucumber_JVM -->
                                                    <dependency>
                                                            <groupId>org.apache.maven.surefire</groupId>
                                                            <artifactId>surefire-junit47</artifactId>
                                                            <version>${surefire.plugin.version}</version>
                                                    </dependency>
                                            </dependencies>
                                            <configuration>
                                                    <rerunFailingTestsCount>2</rerunFailingTestsCount>
                                            </configuration>
                                    </plugin>
                            </plugins>
                    </build>
            </profile>
    </profiles>

这篇关于如何在jenkins中重新运行Cucumber-jvm的失败测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆