Report Customization in Newman need help to add the response body under failed tests tab

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

@danny-dainton Hi Danny your code of default template in customization of report was quite useful, I need your help. In the Failed Tests tab I’m trying to add the response body for the failures but its giving me error.

Error:

C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep>newman run "C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep\UCI - SOAP UI.postman_collection.json" -e "C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep\UCI - Reltio.postman_environment.json" -r htmlextra --reporter-htmlextra-template "C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep\dashboard-template.hbs" -k

C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\helpers.js:28
    throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode);
    ^
Error: if doesn't match with - 645:11
    at validateClose (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\helpers.js:28:11)
    at Object.prepareBlock (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\helpers.js:142:5)
    at Object.anonymous (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\parser.js:65:33)
    at Parser.parse (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\parser.js:367:48)
    at parseWithoutProcessing (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\base.js:46:33)
    at HandlebarsEnvironment.parse (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\base.js:52:13)
    at compileInput (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:508:19)
    at ret (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:517:18)
    at EventEmitter.<anonymous> (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\lib\index.js:329:22)
    at EventEmitter.emit (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\eventemitter3\index.js:203:33)
    at done (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\lib\run\index.js:293:29)
    at C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\backpack\index.js:58:34
    at PostmanCollectionRun._process (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:163:13)
    at PostmanCollectionRun.<anonymous> (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:169:76)
    at listOnTimeout (internal/timers.js:551:17)
    at processTimers (internal/timers.js:494:7) {
  description: undefined,
  fileName: undefined,
  lineNumber: 645,
  endLineNumber: 645,
  number: undefined,
  column: 11,
  endColumn: 13
}

Code I edited is only the highlighted part from your default template:

Hey @jency.stella19

The stacktrace is telling you what the issue is Error: if doesn't match with - 645:11

You need to ensure that the handlebar block expressions are closed out correctly - {{#if}} {{/if}} or {{#with}} {{/with}}

You’ve more that likely removed one of the closing blocks so {{#if}} doesn’t match with {{/with}}

It’s probably the extra {{#if response.body}} on line 646

That was bad me, I removed the extra if but still getting parse error

Error:
C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep>newman run "C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep\UCI - SOAP UI.postman_collection.json" -e "C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep\UCI - Reltio.postman_environment.json" -r htmlextra --reporter-htmlextra-template "C:\Users\stellaj\Documents\Jency\Project\EPICX-Integration\Automation UCI - MDM\SOAP - UCI - 3rd Sep\dashboard-template.hbs" -k
C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\parser.js:267
            throw new Error(str);
            ^

Error: Parse error on line 660:
                {{/each}
-----------------------^
Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID'
    at Parser.parseError (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\parser.js:267:19)
    at Parser.parse (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\parser.js:336:30)
    at parseWithoutProcessing (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\base.js:46:33)
    at HandlebarsEnvironment.parse (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\base.js:52:13)
    at compileInput (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:508:19)
    at ret (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:517:18)
    at EventEmitter.<anonymous> (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman-reporter-htmlextra\lib\index.js:329:22)
    at EventEmitter.emit (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\eventemitter3\index.js:203:33)
    at done (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\lib\run\index.js:293:29)
    at C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\backpack\index.js:58:34
    at PostmanCollectionRun._process (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:163:13)
    at PostmanCollectionRun.<anonymous> (C:\Users\stellaj\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:169:76)
    at listOnTimeout (internal/timers.js:551:17)
    at processTimers (internal/timers.js:494:7)
Error: Parse error on line 660:
                {{/each}
-----------------------^

That is missing a closing } - The stacktrace is literally telling you the issue :laughing:

Once that resolved, you will probably get one for line 661, as it is missing a / in the each block.


So I obviously know what you’re trying to do with adding that response data into the tab but the reason why it’s not there now, is because the data is not present in summary.failures

The response relates to something else specific to the place where it was taken from and it gets the data from somewhere else.

that;s right i tried to fix the parse error but reponse body cannot be fetched

the response is within the ‘{{#*inline “aggregations”}} {{#each executions}}’ body, how can we call it within ‘summary.failures’, cannot get the pinch of it. could of help if you can guide me in this

It’s a bigger problem that you’re trying to solve by bolting something from another area into that tab.

You could get data from there but then how are you going to match that failed test to that response body?

It’s one of the main reasons why I didn’t do that - the whole data set within that tab would need to be redesigned to ensure the relevant details are placed together.

I get that danny, its bit complicated in that case, thanks for the clarification so far

I’m obviously not discouraging you from doing it and would welcome any PRs with that in place. It’s something that people would like to see but i just don’t have the time to redesign the way the tab works at the moment :smiley:

I get that danny, thanks for your support :slight_smile: Let’s see if we can tweak in it later