Extentreport 支持 Cucumber-JVM 4.0 (io.cucumber) [英] Extentreport support for Cucumber-JVM 4.0 (io.cucumber)

查看:20
本文介绍了Extentreport 支持 Cucumber-JVM 4.0 (io.cucumber)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的 Cucumber 自动化项目从 cucumber (info.cukes) 迁移到 cucumber (io.cucumber)

在此过程中,我无法迁移扩展报告.你能帮我解决我所缺少的吗?

依赖:

 <依赖><groupId>junit</groupId><artifactId>junit</artifactId><版本>3.8.1</版本><范围>测试</范围></依赖><依赖性><groupId>io.cucumber</groupId><artifactId>黄瓜-java</artifactId><版本>4.2.6</版本><范围>测试</范围></依赖><!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit --><依赖性><groupId>io.cucumber</groupId><artifactId>黄瓜-junit</artifactId><版本>4.2.6</版本><范围>测试</范围></依赖><!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core --><依赖性><groupId>io.cucumber</groupId><artifactId>黄瓜核心</artifactId><版本>4.2.6</版本></依赖><!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-html --><依赖性><groupId>io.cucumber</groupId><artifactId>黄瓜-html</artifactId><版本>0.2.7</版本></依赖><依赖性><groupId>org.freemarker</groupId><artifactId>freemarker</artifactId><version>2.3.26-孵化</version></依赖><依赖性><groupId>com.vimalselvam</groupId><artifactId>黄瓜范围报告</artifactId><版本>3.0.2</版本></依赖><!-- https://mvnrepository.com/artifact/com.aventstack/extentreports --><依赖性><groupId>com.aventstack</groupId><artifactId>extentreports</artifactId><版本>4.0.9</版本></依赖>

跑步者类:

包 CucumberWithAfterStep.AfterStepPOC;导入java.io.File;导入 org.junit.AfterClass;导入 org.junit.runner.RunWith;导入 com.cucumber.listener.Reporter;导入 cucumber.api.CucumberOptions;进口黄瓜.api.junit.黄瓜;@RunWith(Cucumber.class)@CucumberOptions(features = "src/test/resources/features", 胶水 = { "testSteps" }, plugin = { "pretty","html:target/cucumber", "json:target/cucumber.json", "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html" },单色 = 真,标签 = {"@WAC003 "},dryRun = false)公共类 MainRunnerTest {@下课以后公共静态无效 writeExtentReport() {Reporter.loadXMLConfig(new File(FileReaderManager.getInstance().getConfigReader().getReportConfigPath()));}}

错误:

<块引用>

cucumber.runtime.CucumberException:无法加载插件类:com.cucumber.listener.ExtentCucumberFormatter.它没有实现

黄瓜.api.插件在 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)

解决方案

我也遇到了同样的问题.您可以使用以下依赖项组合,黄瓜芯 4.2.0黄瓜-java 4.2.0黄瓜junit 4.2.0extentreports-cucumber4-适配器 1.0.7

请注意 vimalselvam 开发的 Cucumber-extntsreport 不支持 Cucumber 版本 4.因为 Cucumber 4 使用基于事件的报告,而不是格式化程序.所以删除这个依赖.黄瓜范围报告 3.0.2

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:

    <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>

Runner class:

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()));
    }
 }

Error:

cucumber.runtime.CucumberException: Couldn't load plugin class: com.cucumber.listener.ExtentCucumberFormatter. It does not implement

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)

解决方案

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

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

这篇关于Extentreport 支持 Cucumber-JVM 4.0 (io.cucumber)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆