【发布时间】:2019-10-01 01:53:39
【问题描述】:
我正在使用 BDD 框架中的 Cucumber 运行脚本,并且正在使用 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"));
}
}
我在 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
【问题讨论】:
-
有人可以帮我解决这个问题吗?
标签: selenium-webdriver cucumber bdd extentreports maven-dependency