Поддержка расширенного отчета для Cucumber-JVM 4.0 (io.cucumber) - PullRequest
1 голос
/ 19 апреля 2019

Я пытаюсь перенести мой проект автоматизации Cucumber с огурца (info.cukes) на огурец (io.cucumber)

Во время этого процесса у меня возникают проблемы с переносом расширенных отчетов.Не могли бы вы помочь мне с тем, что мне не хватает?

зависимость:

    <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 at cucumber.runtime.formatter.PluginFactory.loadClass (PluginFactory.java:176) в cucumber.runtime.formatter.PluginFactory.pluginClass (PluginFactory.java:163) для cumer..PluginFactory.getPluginClass (PluginFactory.java:220) по адресу cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName (PluginFactory.java:203) по адресу cucumber.runtime.RuntimeOptions $ ParsedPlutimeOptions.amed.jj_name.jpg ()RuntimeOptions.parse (RuntimeOptions.java:165) в cucumber.runtime.RuntimeOptions. (RuntimeOptions.java:108)

Ответы [ 2 ]

1 голос
/ 20 апреля 2019

Существует 2 способа реализации отчета по экстентам в Cucumber

1. Использование адаптера Cucumber-JVM 4 для Extent Framework (extereports-cucumber4-adapter) и ниже - шаги для реализации -

Добавить зависимость адаптера в POM.XML

<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports-cucumber4-adapter</artifactId>
    <version>1.0.6</version>
</dependency>

Добавьте плагин com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter к бегуну.

@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"})
public class RunCukesTest {
    // ..
} 

Каталог вывода отчета - ../ Каталог проекта / test-output / HtmlReport

* *

* 1023 1024 * 2. Добавление зависимости aventstack в POM.XML

<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>3.1.5</version>
</dependency> 

В этом рабочем процессе Не добавляйте плагин com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter к бегуну.

0 голосов
/ 17 мая 2019

У меня была такая же проблема.Вы можете использовать следующую комбинацию зависимостей: Cucumber-core 4.2.0 Cucumber-java 4.2.0 Cucumber-junit 4.2.0xtrepreports-cucumber4-adapter 1.0.7

Обратите внимание на Cucumber-extntsreport, который разработанvimalselvam не поддерживает версию огурца 4. Потому что огурец 4 использует отчеты на основе событий, а не форматер.так что убери эту зависимость.огурец-экстенсрепорт 3.0.2

...