cucumber.runtime.CucumberException: не удалось загрузить класс плагина: com.cucumber.listener.ExtentCucumberFormatter - PullRequest
0 голосов
/ 14 мая 2019

Я запускаю скрипт с использованием Cucumber в BDD Framework и использую плагин Extent Reports для создания отчета о выполнении.

Я создал класс тестового бегуна, как показано ниже:

import java.io.File;

import org.junit.runner.RunWith;
import org.testng.annotations.AfterClass;

import com.vimalselvam.cucumber.listener.Reporter;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "C:\\Users\\User\\Desktop\\Cucumber - BDD\\CucumberPOM\\src\\main\\java\\com\\qa\\features\\DemoSite.feature"//path of the feature files
        ,glue = {"com/qa/stepDefinitions"} //path of the step definition files
        ,plugin = {"com.cucumber.listener.ExtentCucumberFormatter:target/html/ExtentReport.html"}
    //  ,plugin = {"pretty","html:test-output","json:json_output/cucumber.json","junit:junit_output/cucumber.xml"} //to generate diff types of reporting
        ,monochrome =true //display the console output in a proper readable format
        ,strict=true //it will check if any step is not defined in step definition file
        ,dryRun = false  //to check the mapping is proper btw feature file and step defn file
        //,tags = {"@FuntionalTest" , "~@SmokeTest" , "~@End2EndTest"}
        )

public class TestRunner {

    @AfterClass
    public static void writeExtentReport() {
        Reporter.loadXMLConfig(new File("config/extent-config.xml"));
    }  

}

Я включил приведенную ниже зависимость для отчета Extent в файл POM.xml:

<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.9</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.vimalselvam/cucumber-extentsreport -->
<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.1.1</version>
</dependency>

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

когда я выполняю вышеуказанный класс бегуна, я получаю ошибку - cucumber.runtime.CucumberException: не удалось загрузить класс плагина: com.cucumber.listener.ExtentCucumberFormatter

Ответы [ 2 ]

1 голос
/ 06 июня 2019

com.vimalselvam.cucumber.listener.ExtentCucumberFormatter не поддерживается в Cucumber версии 4. Если вы используете Cucumber 4, вы должны использовать Cucumber Extent Adapter в качестве плагина.см. подробную документацию о том, как использовать ее в своей структуре здесь - http://extentreports.com/docs/versions/4/java/cucumber4.html

1 голос
/ 24 мая 2019

У меня такая же проблема, и для ее решения я изменил плагин в @CucumberOptions:

@ CucumberOptions (plugin = {"com.vimalselvam.cucumber.listener.ExtentCucumberFormatter: path /report.html "})

Но все же, сейчас я сталкиваюсь с другими проблемами.Я надеюсь, что это помогает

...