对Cucumber-JVM 4.0的Extentreport支持(io.cucumber) [英] Extentreport support for Cucumber-JVM 4.0 (io.cucumber)
问题描述
我正在尝试将黄瓜自动化项目从黄瓜(info.cukes)迁移到黄瓜(io.cucumber)
I am trying to migrate my Cucumber automation project from cucumber (info.cukes ) to cucumber (io.cucumber)
在此过程中,我在迁移扩展报告时遇到麻烦.您能帮我解决我所缺少的吗?
During this process, i having trouble with migrating extend reports. Could you please help me with what I am missing?
依赖性:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>4.2.6</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.2.6</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>4.2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-html -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-html</artifactId>
<version>0.2.7</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.26-incubating</version>
</dependency>
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.0.9</version>
</dependency>
亚军类:
package CucumberWithAfterStep.AfterStepPOC;
import java.io.File;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/features", glue = { "testSteps" }, plugin = { "pretty",
"html:target/cucumber", "json:target/cucumber.json" , "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html" },
monochrome = true,
tags = {"@WAC003 "}, dryRun = false)
public class MainRunnerTest {
@AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File(FileReaderManager.getInstance().getConfigReader().getReportConfigPath()));
}
}
错误:
cucumber.runtime.CucumberException: Couldn't load plugin class: com.cucumber.listener.ExtentCucumberFormatter. It does not implement
cucumber.api.Plugin在Cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:176)在Cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:163)在Cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:220)在Cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName(PluginFactory.java:203)在Cucumber.runtime.RuntimeOptions $ ParsedPluginData.addPluginName(RuntimeOptions.java:386)处在Cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:165)在Cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:108)
cucumber.api.Plugin at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:176) at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:163) at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:220) at cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName(PluginFactory.java:203) at cucumber.runtime.RuntimeOptions$ParsedPluginData.addPluginName(RuntimeOptions.java:386) at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:165) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:108)
推荐答案
我遇到了同样的问题.您可以使用以下依赖项组合,黄瓜芯4.2.0黄瓜Java 4.2.0黄瓜junit 4.2.0scopereports-cucumber4-adapter 1.0.7
I had the same issue. you can use the following combination of dependencies, Cucumber-core 4.2.0 Cucumber-java 4.2.0 Cucumber-junit 4.2.0 extentreports-cucumber4-adapter 1.0.7
请注意,由vimalselvam开发的Cucumber-extntsreport不支持黄瓜版本4.因为黄瓜4使用的是基于事件的报告,而不是格式化程序.因此,请删除此依赖项.黄瓜extentsreport 3.0.2
Please note Cucumber-extntsreport which is developed by vimalselvam is not supporting cucumber version 4. Because cucumber 4 is using event based reporting, not the formatter. so remove this dependency. cucumber-extentsreport 3.0.2
这篇关于对Cucumber-JVM 4.0的Extentreport支持(io.cucumber)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!