New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While using BDD style reports appending reports to existing reports does not works and fails with error #1016

Closed
mrunalgosar opened this Issue Jan 19, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@mrunalgosar

mrunalgosar commented Jan 19, 2018

Summary

While using BDD style reports appending reports to existing reports does not works and fails.

Expected Behavior

User should be able to append to existing reports while using BDD style reports.

Current Behavior

ExtentReport fails to generate when trying to append to existing report

Sample

package testng;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.GherkinKeyword;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.ChartLocation;
import org.testng.annotations.Test;

import java.io.File;

public class ExtentTestNGTest {

    @Test
    public void test1() throws ClassNotFoundException {
        ExtentReports extentReports = new ExtentReports();
        File reportFileLocation = new File("ExtentReport.html");
        ExtentHtmlReporter extentHtmlReporter = new ExtentHtmlReporter(reportFileLocation.getName());
        extentHtmlReporter.config().setChartVisibilityOnOpen(true);
        extentHtmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
        extentHtmlReporter.config().setDocumentTitle("Test Tile");
        extentHtmlReporter.config().setReportName("Test Report");
        extentHtmlReporter.setAppendExisting(true);
        extentReports.attachReporter(extentHtmlReporter);
        ExtentTest feature = extentReports.createTest("Test 1");
        ExtentTest scenario = feature.createNode(new GherkinKeyword("Scenario"), "Test Scenario 1");
        ExtentTest step = scenario.createNode(new GherkinKeyword("Given"), "some step");
        extentReports.flush();
    }

    @Test
    public void test2() throws ClassNotFoundException {
        ExtentReports extentReports = new ExtentReports();
        File reportFileLocation = new File("ExtentReport.html");
        ExtentHtmlReporter extentHtmlReporter = new ExtentHtmlReporter(reportFileLocation.getName());
        extentHtmlReporter.config().setChartVisibilityOnOpen(true);
        extentHtmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
        extentHtmlReporter.config().setDocumentTitle("Test Tile");
        extentHtmlReporter.config().setReportName("Test Report");
        extentHtmlReporter.setAppendExisting(true);
        extentReports.attachReporter(extentHtmlReporter);
        ExtentTest feature = extentReports.createTest("Test 2");
        ExtentTest scenario = feature.createNode(new GherkinKeyword("Scenario"), "Test Scenario 2");
        ExtentTest step = scenario.createNode(new GherkinKeyword("Given"), "some step");
        extentReports.flush();
    }
}

Failure Log:

Jan 20, 2018 1:15:22 AM freemarker.log._JULLoggerFactory$JULLogger error
SEVERE: Error executing FreeMarker template
FreeMarker template error:
The following has evaluated to null or missing:
==> log.details  [in template "test-view/bdd.ftl" at line 51, column 53]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${log.details}  [in template "test-view/bdd.ftl" at line 51, column 50]
	- Reached through: #include "bdd.ftl"  [in template "test-view/test-view.ftl" at line 110, column 57]
	- Reached through: #include "test-view/test-view.ftl"  [in template "index.ftl" at line 55, column 25]
----

Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
	at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:465)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:387)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:356)
	at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:96)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:59)
	at freemarker.core.Environment.visit(Environment.java:362)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:362)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:368)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.include(Environment.java:2508)
	at freemarker.core.Include.accept(Include.java:171)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:368)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:332)
	at freemarker.core.Environment.include(Environment.java:2508)
	at freemarker.core.Include.accept(Include.java:171)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:332)
	at freemarker.core.Environment.process(Environment.java:305)
	at freemarker.template.Template.process(Template.java:378)
	at com.aventstack.extentreports.reporter.ExtentHtmlReporter.flush(ExtentHtmlReporter.java:142)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at com.aventstack.extentreports.Report.notifyReporters(Report.java:247)
	at com.aventstack.extentreports.Report.flush(Report.java:169)
	at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:272)
	at testng.ExtentTestNGTest.test2(ExtentTestNGTest.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:782)
	at org.testng.TestRunner.run(TestRunner.java:632)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
	at org.testng.SuiteRunner.run(SuiteRunner.java:268)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.run(TestNG.java:1064)
	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)

Jan 20, 2018 1:15:22 AM com.aventstack.extentreports.reporter.ExtentHtmlReporter flush
SEVERE: Template not found
FreeMarker template error:
The following has evaluated to null or missing:
==> log.details  [in template "test-view/bdd.ftl" at line 51, column 53]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${log.details}  [in template "test-view/bdd.ftl" at line 51, column 50]
	- Reached through: #include "bdd.ftl"  [in template "test-view/test-view.ftl" at line 110, column 57]
	- Reached through: #include "test-view/test-view.ftl"  [in template "index.ftl" at line 55, column 25]
----

Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
	at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:465)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:387)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:356)
	at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:96)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:59)
	at freemarker.core.Environment.visit(Environment.java:362)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:362)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:368)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.include(Environment.java:2508)
	at freemarker.core.Include.accept(Include.java:171)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:368)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:315)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:332)
	at freemarker.core.Environment.include(Environment.java:2508)
	at freemarker.core.Include.accept(Include.java:171)
	at freemarker.core.Environment.visit(Environment.java:326)
	at freemarker.core.Environment.visit(Environment.java:332)
	at freemarker.core.Environment.process(Environment.java:305)
	at freemarker.template.Template.process(Template.java:378)
	at com.aventstack.extentreports.reporter.ExtentHtmlReporter.flush(ExtentHtmlReporter.java:142)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at com.aventstack.extentreports.Report.notifyReporters(Report.java:247)
	at com.aventstack.extentreports.Report.flush(Report.java:169)
	at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:272)
	at testng.ExtentTestNGTest.test2(ExtentTestNGTest.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:782)
	at org.testng.TestRunner.run(TestRunner.java:632)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
	at org.testng.SuiteRunner.run(SuiteRunner.java:268)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.run(TestNG.java:1064)
	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)

Jan 20, 2018 1:15:22 AM com.aventstack.extentreports.utils.Writer write

SEVERE: ExtentReport.html
java.lang.NullPointerException
	at java.io.Writer.write(Writer.java:157)
	at com.aventstack.extentreports.utils.Writer.write(Writer.java:23)
	at com.aventstack.extentreports.reporter.ExtentHtmlReporter.flush(ExtentHtmlReporter.java:151)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at com.aventstack.extentreports.Report.notifyReporters(Report.java:247)
	at com.aventstack.extentreports.Report.flush(Report.java:169)
	at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:272)
	at testng.ExtentTestNGTest.test2(ExtentTestNGTest.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)

	at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
===============================================

Default Suite	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
Total tests run: 2, Failures: 0, Skips: 0
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)

===============================================

	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:782)
	at org.testng.TestRunner.run(TestRunner.java:632)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
	at org.testng.SuiteRunner.run(SuiteRunner.java:268)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.run(TestNG.java:1064)
	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)


Process finished with exit code 0

Environment Details

  • Extent report Version used:3.1.2
  • Operating System and version: Windows 7
  • JDK Version: java 8

Screenshots

@anshooarora anshooarora added the bug label Feb 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment