trivago / cluecumber

Clear and concise reporting for the Cucumber BDD JSON format.

Home Page:https://www.softwaretester.blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not render page content:The following has evaluated to null or missing:attachment.filename

apache-ctl opened this issue · comments

Describe the bug
When using @before and @after scenario hooks the attachments aren't shown in the report. The report generation is failing with an error message" Could not render page content:The following has evaluated to null or missing:attachment.filename"

A detailed error log is provided below:
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- cluecumber-report-plugin:2.3.1:reporting (default-cli) @ test-core ---
[INFO] ------------------------------------------------------------------------
[INFO] Cluecumber Report Maven Plugin, version 2.3.1
[INFO] ------------------------------------------------------------------------
[INFO] - source JSON report directory : build/report/cucumber
[INFO] - generated HTML report directory : build/target/report/cucumber
[INFO] ------------------------------------------------------------------------
[INFO] - fail pending/undefined scenarios : false
[INFO] - expand before/after hooks : false
[INFO] - expand step hooks : false
[INFO] - expand doc strings : false
[INFO] - page title : Cluecumber Report
[INFO] - colors (passed, failed, skipped) : #28a745, #dc3545, #ffc107
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.775 s
[INFO] Finished at: 2020-01-22T16:50:09-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.trivago.rta:cluecumber-report-plugin:2.3.1:reporting (default-cli) on project test-core: Could not render page content: The following has evaluated to null or missing:
[ERROR] ==> attachment.filename [in template "macros/scenario.ftl" at line 136, column 86]

[ERROR]
[ERROR] ----
[ERROR] Tip: It's the step after the last dot that caused this error, not those before it.
[ERROR] ----
[ERROR] Tip: If the failing expression is known to 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)??
[ERROR] ----
[ERROR]
[ERROR] ----
[ERROR] FTL stack trace ("~" means nesting-related):
[ERROR] - Failed at: ${attachment.filename} [in template "macros/scenario.ftl" in macro "attachments" at line 136, column 84]
[ERROR] - Reached through: @scenario.attachments step=before [in template "scenario-detail.ftl" at line 100, column 29]
[ERROR] ~ Reached through: #nested [in template "macros/page.ftl" in macro "card" at line 79, column 17]
[ERROR] ~ Reached through: @page.card width="12" title="Before H... [in template "scenario-detail.ftl" at line 84, column 13]
[ERROR] ~ Reached through: #nested [in template "macros/page.ftl" in macro "page" at line 61, column 13]
[ERROR] ~ Reached through: @page.page title="${pageTitle} - Scen... [in template "scenario-detail.ftl" at line 22, column 1]
[ERROR] ----
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

To Reproduce
Steps to reproduce the behavior:

  1. Create a hook for @before and @after
  2. Take a screenshot from the selenium
  3. Attach the screenshot to the Scenario.
  4. Generate the cucumber.json report
  5. The cluecumber-report plugin fails with the error message above.
  6. The attachments within generated reports does contain the attachment*.png files.
  7. But, scenario attachment step fails during report generation.

Was able to replicate the issue with earlier released versions of the cluecumber-report-plugin.
The report generation works with attachments for plugin versions below 0.7.1 but fails with higher plugin versions.

Expected behavior
The attachments should appear for the before and after scenario hooks.

Attachments
Attached is the example json file for my use case

cucumber-json.txt

Hello @gybharath ,
Thanks for reporting - I will investigate this.

Thank you @laxersaz ! Please let me know if you need any additional information.

I can reproduce this. Will let you know if I require more information.

The first 4 of the attachments are generated but the fifth one is apparently failing... Let's see what I find :-)

ok

Continuing investigation now...

I found the issue and will release a bugfix version today.

Fixed in 2.3.3

Thanks for fixing the issue. I confirm that it is working fine now. Thanks!