尝试生成Cucumber报告时出现CucumberException

时间:2018-08-21 09:57:44

标签: java maven cucumber report

我正在尝试为黄瓜测试执行生成不同类型的报告。

起初,我按照以下方式处理基本报告

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)

@CucumberOptions(
        features = {"src/test/features"},
        tags = {"@Search"},
        plugin = {
                "json:target/cucumber.json",
                "junit:target/cucumber-results.xml",
                "pretty:target/cucumber-pretty.txt",
                "html:target/cucumber-html-report",}
)

public class TestRunner {
}

但是现在我正尝试生成其他报告,以便与团队共享并确定哪一个更有用。

import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)

@ExtendedCucumberOptions(jsonReport = "target/cucumber.json",
        retryCount = 3,
        detailedReport = true,
        detailedAggregatedReport =true,
        overviewReport = true,
        coverageReport = true,
        jsonUsageReport = "target/cucumber-usage.json",
        toPDF = true,
        includeCoverageTags = {"@chrome"},
        outputFolder = "target"
)

@CucumberOptions(
        strict = true,
        features = {"src/test/features"},
        tags = {"@Search"},
        plugin = {
                "pretty:STDOUT",
                "json:target/cucumber.json",
                "usage:target/cucumber-usage.json",
                "junit:target/cucumber-results.xml",
                "pretty:target/cucumber-pretty.txt",
                "html:target/cucumber-html-report",
                "rerun:target/rerun.txt"},
        monochrome = true,
        glue = ("com.cucumber.test")
)

public class TestRunner {
}

但是当我执行测试运行程序时,会返回一个黄瓜异常。

cucumber.runtime.CucumberException: java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS

根据我在博客上检查的内容,可能与某些依赖项有关。 但是,我遵循不同的指南,但无法解决。

    <!-- https://mvnrepository.com/artifact/com.github.mkolisnyk/cucumber-runner -->
    <dependency>
        <groupId>com.github.mkolisnyk</groupId>
        <artifactId>cucumber-reports</artifactId>
        <version>1.0.2</version>
        <exclusions>
            <exclusion>
                <artifactId>xml-apis</artifactId>
                <groupId>xml-apis</groupId>
            </exclusion>
            <exclusion>
                <artifactId>fop</artifactId>
                <groupId>fop</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>1.4.01</version>
    </dependency>

基本上我想获得的是pdf文件中包含的报告,以便团队可以从那里查看结果。

关于团队如何可视化被推送到github的html报告的任何其他想法都将受到欢迎(我们将避免Jenkins)。

0 个答案:

没有答案