【问题标题】:Missing report result - report was not successfully completed with CucumberReport缺少报告结果 - 未使用 CucumberReport 成功完成报告
【发布时间】:2019-05-07 14:05:47
【问题描述】:

有一个类似的问题here,但没有答案,也没有解决它的进展。

我正在使用 Cucumber 和 Gradle 作为构建工具运行 Selenium 测试。在詹金斯。

这是我的build.gradle 文件:

task cucumber() {
    dependsOn assemble, compileTestJava
    doLast{
        javaexec {
            main = "cucumber.api.cli.Main"
            classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
            args = ['--plugin', 'pretty', '--glue', 'stepmethods', 'src/main/java/features', '--tags', 'not @proba and not @test and not @rucno and not @nedovrseno']

        }
    }
}

我想从我正在测试的功能中排除一些场景,所以我将 '--tags', 'not @proba and not @test and not @rucno and not @nedovrseno' 部分添加到 Gradle 任务参数中。

在那之后(我不是 100% 确定这是原因)测试在 Jenkins 作业中运行良好,但没有生成带有 Cucumber reports plugin 的报告。

相反,这是 Jenkins 控制台输出:

15:09:02 BUILD SUCCESSFUL in 1m 58s
15:09:02 3 actionable tasks: 3 executed
15:09:02 Build step 'Invoke Gradle script' changed build result to SUCCESS
15:09:02 [CucumberReport] Using Cucumber Reports version 4.6.0
15:09:02 [CucumberReport] JSON report directory is ""
15:09:02 [CucumberReport] Copied 1 json files from workspace "C:\Users\me\.jenkins\workspace\Project Name" to reports directory "C:\Users\me\.jenkins\jobs\Project Name\builds\12\cucumber-html-reports\.cache"
15:09:02 [CucumberReport] Copied 4 properties files from workspace "C:\Users\me\.jenkins\workspace\Project Name" to reports directory "C:\Users\me\.jenkins\jobs\Project Name\builds\12\cucumber-html-reports\.cache"
15:09:02 [CucumberReport] Processing 1 json files:
15:09:02 [CucumberReport] C:\Users\me\.jenkins\jobs\Project Name\builds\12\cucumber-html-reports\.cache\report.json
15:09:02 [CucumberReport] Missing report result - report was not successfully completed
15:09:02 [CucumberReport] Build status is left unchanged
15:09:02 Finished: SUCCESS

因此,文件已处理,但报告丢失。可能是什么问题?

【问题讨论】:

    标签: jenkins gradle cucumber report cucumber-jvm


    【解决方案1】:

    编辑

    在字符串中添加了第二个“--plugin”以说明 OP 的发现。

    删除了其他示例。


    试试

    task cucumber() {
        dependsOn assemble, compileTestJava
        doLast{
            javaexec {
                main = "cucumber.api.cli.Main"
                classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
                args = ['--plugin', 'pretty', '--plugin', 'html:some/dir', '--glue', 'stepmethods', 'src/main/java/features', '--tags', 'not @proba and not @test and not @rucno and not @nedovrseno']
    
            }
        }
    }
    

    您没有指定要生成的报告,也没有指定生成的位置。这给你漂亮和 html。

    【讨论】:

    • 我收到Exception in thread "main" java.lang.IllegalArgumentException: Unsupported scheme: html:report at cucumber.runtime.io.MultiLoader.resources(MultiLoader.java:25) at cucumber.runtime.model.FeatureLoader.loadFromFeaturePath(FeatureLoader.java:42) at cucumber.runtime.model.FeatureLoader.load(FeatureLoader.java:36) at cucumber.runtime.model.FeatureLoader.load(FeatureLoader.java:22) at cucumber.runtime.FeaturePathFeatureSupplier.get(FeaturePathFeatureSupplier.java:23)...
    • 请用任务 cucumber() 的当前内容更新您的问题。
    • 我能够让它工作,但我需要在 'json:report.json' 前面加上 '--plugin',像这样:args = ['--plugin', 'pretty', '--plugin', 'json:report.json', '--glue', 'stepmethods', 'src/main/java/features', '--tags', 'not @proba and not @test and not @rucno and not @nedovrseno']
    • 这是有道理的。 “--plugin 选项可以指定实现 gherkin.formatter.Formatter、gherkin.formatter.Reporter、cucumber.api.StepDefinitionReporter 中的一个或多个的类”。我想知道你需要的是 '--plugin', 'pretty, html:some/dir', ...
    猜你喜欢
    • 2018-07-16
    • 2019-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-14
    相关资源
    最近更新 更多