重新运行.txt在 Cucumber 中引用类路径而不是功能文件夹



我正在运行黄瓜测试(在 Jenkins 中使用 Maven)并将失败的场景输出到目标/重新运行.txt,按照以下说明:https://github.com/cucumber/cucumber-jvm/issues/890

它创建重新运行.txt并输入失败的方案,但将它们输入为:features/name.feature:2。然后重新运行尝试将它们作为类路径/name.feature运行,并且看不到它们在src/test/resources/features中。

如果我将功能文件放在类路径中,则会出现不一致的过滤器错误(可能是因为我在第一次调用中使用了标签,在第二次调用中使用了文本)。

如何让 Cucumber 输出正确的功能路径,或者让它根据重新运行.txt找到功能?

错误:

跑步com.xxx.cucumber._RunCukesTest 测试运行: 1, 失败: 0, 错误: 1, 跳过: 0, 已用时间: 0.002 秒 <<<失败!>

初始化错误(com.xxx.cucumber._RunCukesTest) 已用时间:0 秒<<<错误!>

java.lang.IllegalArgumentException:既不在文件系统上找到,也不在类路径上找到:不是文件或目录:classpath\SubFolder\Test1.feature,

未找到以下资源:类路径:子文件夹/测试1.功能

附加信息:对测试的所有初始调用都是通过标记完成的。所有功能都位于类路径/src/test/resources/features 的子文件夹中这个测试必须每天在 Jenkins 中自动运行。

第一次运行使用以下内容:

@RunWith(Cucumber.class)
@CucumberOptions(
    strict = false,
    features={"src/test/resources/features/"},
    snippets=SnippetType.CAMELCASE, 
    plugin = { "pretty", "json:target/cucumber-reports/test-report.json", "html:target/cucumber-reports",
            "rerun:target/rerun.txt"})
public class RunCukesTest {
}

第二次运行失败场景使用以下内容:

@RunWith(Cucumber.class)
@CucumberOptions(
    strict = false,
    features={"@target/rerun.txt"},
    snippets=SnippetType.CAMELCASE, 
    plugin = {"pretty", "json:target/cucumber-reports/test-report.json", "html:target/cucumber-reports"})
public class _RunCukesTest {
}

将第一个测试运行程序的功能文件位置更改为features = "."这将使"重新运行.txt"更新为功能文件的正确路径。

相关内容

最新更新