Java 无法生成扩展数据块报告

Java 无法生成扩展数据块报告,java,cucumber,extentreports,Java,Cucumber,Extentreports,使用插件com.vimalselvam.cucumber.listener.ExtentCucumberFormatter(唯一对我有效的插件),生成了我的报告,但intellij的日志上有几个错误 我试图生成一个没有定义场景的报告(只是为了速度)。使用多个插件,如 以下是我正在使用的依赖项: <dependency> <groupId>info.cukes</groupId> <artifactId>

使用插件com.vimalselvam.cucumber.listener.ExtentCucumberFormatter(唯一对我有效的插件),生成了我的报告,但intellij的日志上有几个错误

我试图生成一个没有定义场景的报告(只是为了速度)。使用多个插件,如

以下是我正在使用的依赖项:

<dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.5</version>
</dependency>
 <dependency>
            <groupId>com.vimalselvam</groupId>
            <artifactId>cucumber-extentsreport</artifactId>
            <version>3.1.1</version>
</dependency>
<dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports</artifactId>
            <version>4.0.9</version>
</dependency>
<dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports-cucumber4-adapter</artifactId>
            <version>1.0.7</version>
</dependency>
错误:

log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.


java.lang.NoSuchMethodError: com.aventstack.extentreports.reporter.ExtentHtmlReporter.loadXMLConfig(Ljava/io/File;)V

at com.vimalselvam.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:66)
at test.runner.TestRunner.writeExtentReport(TestRunner.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


java.lang.NullPointerException
    at com.vimalselvam.cucumber.listener.ExtentCucumberFormatter.result(ExtentCucumberFormatter.java:252)...

您在pom.xml中同时使用vimal、avenstack和适配器依赖项,这是不可取的,也是不应该的。在特定用例中,应使用vimal或avenstack或两者同时使用,或仅使用适配器依赖项。请按照以下说明操作

Vimal Selvam库:下面是所需的maven依赖项和示例测试,以演示如何完成配置设置

Maven依赖关系

<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.1.1</version>
</dependency>


<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.9</version>
</dependency>
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports-cucumber4-adapter</artifactId>
    <version>1.0.6</version>
</dependency>
上述设置将在输出目录中生成名为report.html的报告

请从pom.xml中删除适配器依赖项。我们将使用vimal/AventStack或扩展适配器,但不能一起使用

扩展适配器:很好,除了在下面的runner中设置适配器之外,您不需要在任何地方编写任何代码来生成报告

Maven依赖关系

<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.1.1</version>
</dependency>


<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.9</version>
</dependency>
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports-cucumber4-adapter</artifactId>
    <version>1.0.6</version>
</dependency>
报告输出目录-../Project目录/test Output/HtmlReport

附加说明:将来,我们会要求您使用Cucumberv>=4.0.0,因为您使用的是Cucumber的非常旧的依赖项(v1.2.5

为此,您可以添加以下最小依赖项集

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>4.2.6</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-picocontainer</artifactId>
    <version>4.2.6</version>
    <scope>test</scope>
</dependency>

黄瓜
黄瓜刺柏
4.2.6
测试
黄瓜
黄瓜皮容器
4.2.6
测试

您在pom.xml中同时使用vimal、AventStack和适配器依赖项,这是不可取的,也是不应该的。在特定用例中,应使用vimal或avenstack或两者同时使用,或仅使用适配器依赖项。请按照以下说明操作

Vimal Selvam库:下面是所需的maven依赖项和示例测试,以演示如何完成配置设置

Maven依赖关系

<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.1.1</version>
</dependency>


<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.9</version>
</dependency>
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports-cucumber4-adapter</artifactId>
    <version>1.0.6</version>
</dependency>
上述设置将在输出目录中生成名为report.html的报告

请从pom.xml中删除适配器依赖项。我们将使用vimal/AventStack或扩展适配器,但不能一起使用

扩展适配器:很好,除了在下面的runner中设置适配器之外,您不需要在任何地方编写任何代码来生成报告

Maven依赖关系

<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.1.1</version>
</dependency>


<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.9</version>
</dependency>
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports-cucumber4-adapter</artifactId>
    <version>1.0.6</version>
</dependency>
报告输出目录-../Project目录/test Output/HtmlReport

附加说明:将来,我们会要求您使用Cucumberv>=4.0.0,因为您使用的是Cucumber的非常旧的依赖项(v1.2.5

为此,您可以添加以下最小依赖项集

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>4.2.6</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-picocontainer</artifactId>
    <version>4.2.6</version>
    <scope>test</scope>
</dependency>

黄瓜
黄瓜刺柏
4.2.6
测试
黄瓜
黄瓜皮容器
4.2.6
测试

org.apache.maven.plugins
maven编译器插件
3.7.0
1.8
1.8
org.apache.maven.plugins
maven surefire插件
2.21.0
班级
2.
${suiteXmlFile}
网络智囊团
马文黄瓜报道
4.10.0
执行
验证
生成
黄瓜
${project.build.directory}/html报告
${project.build.directory}/cucumber.json
麻省理工学院执照
http://www.opensource.org/licenses/mit-license.php
回购
UTF-8
4.8.0
黄瓜
黄瓜刺柏
${cumber.version}
黄瓜
黄瓜皮容器
${cumber.version}
测试
黄瓜
黄瓜皮容器
${cumber.version}
测试
信息杯
小黄瓜
2.12.2
假如
org.testng
testng
6.9.10
com.beust
jcommander
1.72
黄瓜
黄瓜试验
${cumber.version}
org.apache.poi
poi
3.17
org.apache.poi
poi ooxml
3.17
木卫一
java客户端
6.1.0
朱尼特
朱尼特
4.12
测试
com.aventstack
克洛夫记者
5.0.0
io.github.bonigarcia
webdrivermanager
3.8.0
log4j
log4j
1.2.17
org.se