extent-framework / extentreports-java

Extent Reporting Library, Java
http://extentreports.com
Apache License 2.0
226 stars 130 forks source link

Extent report is not logging all test cases #385

Open ayushi-nyk opened 1 year ago

ayushi-nyk commented 1 year ago

Issue- Extent report throwing error on "flush" method due to which all test cases are not getting logged, below is the error and version used -

    <!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.32</version>
    </dependency>

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

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

    <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>8.2.1</version>
    </dependency>

Jul 01, 2023 5:50:42 AM freemarker.log._JULLoggerFactory$JULLogger error SEVERE: Error executing FreeMarker template FreeMarker template error: An error has occurred when reading existing sub-variable "failed"; see cause exception! The type of the containing value was: extended_hash+string (com.aventstack.extentreports.model.context.NamedAttributeContext wrapped into f.e.b.StringModel)


FTL stack trace ("~" means nesting-related):

Java stack trace (for programmers):

freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...] at freemarker.ext.beans.BeanModel.get(BeanModel.java:185) at freemarker.core.Dot._eval(Dot.java:43) at freemarker.core.Expression.eval(Expression.java:101) at freemarker.core.EvalUtil.compare(EvalUtil.java:113) at freemarker.core.ComparisonExpression.evalToBoolean(ComparisonExpression.java:78) at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:48) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:321) at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271) at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244) at freemarker.core.Environment.visitIteratorBlock(Environment.java:645) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.Environment.visitAndTransform(Environment.java:502) at freemarker.core.CompressedBlock.accept(CompressedBlock.java:42) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:377) at freemarker.core.Environment.invokeMacroOrFunctionCommonPart(Environment.java:877) at freemarker.core.Environment.invokeMacro(Environment.java:813) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.include(Environment.java:3104) at freemarker.core.Include.accept(Include.java:171) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:321) at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271) at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244) at freemarker.core.Environment.visitIteratorBlock(Environment.java:645) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.process(Environment.java:314) at freemarker.template.Template.process(Template.java:383) at com.aventstack.extentreports.templating.FreemarkerTemplate.processTemplate(FreemarkerTemplate.java:52) at com.aventstack.extentreports.templating.FreemarkerTemplate.getSource(FreemarkerTemplate.java:39) at com.aventstack.extentreports.templating.FreemarkerTemplate.writeTemplate(FreemarkerTemplate.java:45) at com.aventstack.extentreports.reporter.AbstractFileReporter.processTemplate(AbstractFileReporter.java:74) at com.aventstack.extentreports.reporter.ExtentSparkReporter.flush(ExtentSparkReporter.java:149) at com.aventstack.extentreports.reporter.ExtentSparkReporter.access$100(ExtentSparkReporter.java:27) at com.aventstack.extentreports.reporter.ExtentSparkReporter$1.onNext(ExtentSparkReporter.java:121) at com.aventstack.extentreports.reporter.ExtentSparkReporter$1.onNext(ExtentSparkReporter.java:113) at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310) at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226) at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83) at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85) at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:279) at core.result.handler.ExtentReporting.setTestCaseDescReport(ExtentReporting.java:154) at core.classes.TestObjectHandler.executeTask(TestObjectHandler.java:422) at core.classes.TestObjectHandler.lambda$assignTasks_ForParallelExecution$1(TestObjectHandler.java:599) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.reflect.InvocationTargetException at jdk.internal.reflect.GeneratedMethodAccessor83.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1553) at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:233) at freemarker.ext.beans.BeanModel.get(BeanModel.java:152) ... 55 more Caused by: java.lang.NullPointerException at com.aventstack.extentreports.model.context.NamedAttributeContext.get(NamedAttributeContext.java:58) at com.aventstack.extentreports.model.context.NamedAttributeContext.getFailed(NamedAttributeContext.java:62) ... 61 more

Jul 01, 2023 5:50:42 AM com.aventstack.extentreports.reporter.ExtentSparkReporter flush SEVERE: An exception occurred FreeMarker template error: An error has occurred when reading existing sub-variable "failed"; see cause exception! The type of the containing value was: extended_hash+string (com.aventstack.extentreports.model.context.NamedAttributeContext wrapped into f.e.b.StringModel)


FTL stack trace ("~" means nesting-related):

Java stack trace (for programmers):

freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...] at freemarker.ext.beans.BeanModel.get(BeanModel.java:185) at freemarker.core.Dot._eval(Dot.java:43) at freemarker.core.Expression.eval(Expression.java:101) at freemarker.core.EvalUtil.compare(EvalUtil.java:113) at freemarker.core.ComparisonExpression.evalToBoolean(ComparisonExpression.java:78) at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:48) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:321) at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271) at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244) at freemarker.core.Environment.visitIteratorBlock(Environment.java:645) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.Environment.visitAndTransform(Environment.java:502) at freemarker.core.CompressedBlock.accept(CompressedBlock.java:42) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:377) at freemarker.core.Environment.invokeMacroOrFunctionCommonPart(Environment.java:877) at freemarker.core.Environment.invokeMacro(Environment.java:813) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.include(Environment.java:3104) at freemarker.core.Include.accept(Include.java:171) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:321) at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271) at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244) at freemarker.core.Environment.visitIteratorBlock(Environment.java:645) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.process(Environment.java:314) at freemarker.template.Template.process(Template.java:383) at com.aventstack.extentreports.templating.FreemarkerTemplate.processTemplate(FreemarkerTemplate.java:52) at com.aventstack.extentreports.templating.FreemarkerTemplate.getSource(FreemarkerTemplate.java:39) at com.aventstack.extentreports.templating.FreemarkerTemplate.writeTemplate(FreemarkerTemplate.java:45) at com.aventstack.extentreports.reporter.AbstractFileReporter.processTemplate(AbstractFileReporter.java:74) at com.aventstack.extentreports.reporter.ExtentSparkReporter.flush(ExtentSparkReporter.java:149) at com.aventstack.extentreports.reporter.ExtentSparkReporter.access$100(ExtentSparkReporter.java:27) at com.aventstack.extentreports.reporter.ExtentSparkReporter$1.onNext(ExtentSparkReporter.java:121) at com.aventstack.extentreports.reporter.ExtentSparkReporter$1.onNext(ExtentSparkReporter.java:113) at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310) at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226) at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83) at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85) at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:279) at core.result.handler.ExtentReporting.setTestCaseDescReport(ExtentReporting.java:154) at core.classes.TestObjectHandler.executeTask(TestObjectHandler.java:422) at core.classes.TestObjectHandler.lambda$assignTasks_ForParallelExecution$1(TestObjectHandler.java:599) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.reflect.InvocationTargetException at jdk.internal.reflect.GeneratedMethodAccessor83.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1553) at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:233) at freemarker.ext.beans.BeanModel.get(BeanModel.java:152) ... 55 more Caused by: java.lang.NullPointerException at com.aventstack.extentreports.model.context.NamedAttributeContext.get(NamedAttributeContext.java:58) at com.aventstack.extentreports.model.context.NamedAttributeContext.getFailed(NamedAttributeContext.java:62) ... 61 more

ayushi-nyk commented 1 year ago

@anshooarora can you help us here !

anshooarora commented 1 year ago

Can you share a project/snippet with me that reproduces this?