Reputation: 11
While running the below code I found following exception. Please help me to resolve the issue. I tried with changing freemaker jar files too.
public class sample1 {
public static void main(String[] args) throws IOException {
ExtentHtmlReporter htmlReporter = new
ExtentHtmlReporter("extent.html");
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
ExtentTest test = extent.createTest("MyFirstTest", "Sample description");
test.log(Status.INFO, "This step shows usage of log(status, details)");
test.info("This step shows usage of info(details)");
MediaEntityBuilder
.createScreenCaptureFromPath("screenshot.png")
.build());
test.addScreenCaptureFromPath("screenshot.png");
extent.flush();
}
}
Error details:
Exception in thread "main" java.lang.NoSuchFieldError: VERSION_2_3_23
at com.aventstack.extentreports.reporter.ExtentHtmlReporter.start(ExtentHtmlReporter.java:93)
at com.aventstack.extentreports.Report.attach(Report.java:55)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at com.aventstack.extentreports.ExtentReports.attachReporter(ExtentReports.java:68)
at com.br.mainsript.sample1.main(sample1.java:23)
Upvotes: 0
Views: 3482
Reputation: 11
Thank you. Just i upgraded my eclipse version from Juno to latest oxygen and found that issue is rrsolved. Issue due to java complier version. When I upgraded to jre8 it is working fine.
Upvotes: 0
Reputation: 2836
You need to download the current version 3 of the community edition. The version you have does not support the reporter attachments. Below is the maven depenency:
<!-- pom.xml -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.5</version>
</dependency>
Upvotes: 0