使用gradle的ExtentReport

时间:2019-03-05 15:01:02

标签: extentreports

在我的项目中,我使用gradle。以下是我对黄瓜和范围报告的依赖

testCompile group: 'com.vimalselvam', name: 'cucumber-extentsreport', version: '3.1.1'
testCompile group: 'com.aventstack', name: 'extentreports', version: '4.0.9'
testCompile 'io.cucumber:cucumber-java:4.2.0'
testCompile 'io.cucumber:cucumber-junit:4.2.0'
compile group: 'junit', name: 'junit', version: '4.12

此外,我在resources文件夹中创建了scope-config.xml文件。在我的Testrunner类中,我有以下代码

@RunWith(Cucumber.class)@CucumberOptions(features = "featurefiles", plugin = { "pretty", "html:target/cucumber-reports","com.vimalselvam.cucumber.listener.ExtentCucumberFormatter:target/report.html" },glue = {"StepDefinition","FunctionsLibrary/DataTableConfigurer.java"},tags = "@Runthistest")

public class TestRunner {
@BeforeClass
public static void setup() {
ExtentProperties extentProperties = ExtentProperties.INSTANCE;
extentProperties.setReportPath("target/myreport.html");
}
@AfterClass
  public static void report(){
Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml"));

 }
}

我收到以下错误

java.lang.NoClassDefFoundError: gherkin/formatter/Reporter

在此提供任何帮助

1 个答案:

答案 0 :(得分:0)

对于Cucumber版本4,使用官方适配器之一:

testCompile group: 'com.aventstack', name: 'extentreports-cucumber4-adapter', version: '1.0.6'
testCompile group: 'com.aventstack', name: 'extentreports', version: '4.0.9'
testCompile 'io.cucumber:cucumber-java:4.2.0'
testCompile 'io.cucumber:cucumber-junit:4.2.0'
compile group: 'junit', name: 'junit', version: '4.12

https://github.com/extent-framework/extentreports-cucumber4-adapter