简体   繁体   English

是否可以并行重新运行失败的黄瓜测试?

[英]Is is possible to rerun failed cucumber tests in parallel?

Is there a way to pass a text file with failed cucumber features to parallel_cucumber? 有没有办法将黄瓜功能失败的文本文件传递给parallel_cucumber?


Example: You have a cucumber.yml with a parallel profile 示例:您有一个带有并行配置文件的cucumber.yml

#cucumber.yml
parallel: -r features --format ParallelTests::Cucumber::FailuresLogger --out rerun.txt

you can run 你可以跑

bundle exec parallel_cucumber -o "-p parallel"

You can run the output rerun.txt file with the command 您可以使用以下命令运行输出rerun.txt文件

bundle exec cucumber @rerun.txt

How can I rerun the failures in parallel? 如何并行重新运行故障?

I figured out how to do this after a bunch of googling/trial and error. 经过一番谷歌搜索/尝试和错误后,我想出了该怎么做。 Settled on this for the rerun command. 为此,需要重新运行命令。

bundle exec parallel_cucumber -n 40 -o "-p parallel" --group-by scenarios `cat rerun.txt`

They key part is --group-by scenarios `cat rerun.txt` 它们的关键部分是--group-by方案`cat rerun.txt`。

The other stuff in there is just the syntax for specifying a cucumber profile with parallel tests and the number of threads to run it on. 其中的其他内容只是用于指定带有并行测试的黄瓜概要文件的语法以及运行该概要文件的线程数。

The full makefile for the CI job looks like this: CI作业的完整makefile如下所示:

FEATURE?=features/

run_tests:
    @echo ---- running tests ----
    @bundle exec parallel_cucumber -n 40 -o "-p parallel" ${FEATURE} --ignore-tags @flaky,@broken --group-by scenarios || \
    @if [ -s rerun.txt ]; then \
        echo "-------> tests failed, rerunning" ; \
        RERUN='RERUN ' bundle exec parallel_cucumber -n 40 -o "-p parallel" --group-by scenarios `cat rerun.txt`; \
    fi

.PHONY: run_tests

Thanks @dSkech for reminding me to answer my own question. 感谢@dSkech提醒我回答我自己的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM