DannyDainton / newman-reporter-htmlextra

A HTML reporter for Postman's Command Line Runner, Newman. Includes Non Aggregated Runs broken down by Iterations, Skipped Tests, Console Logs and the handlebars helpers module for better custom templates.
Apache License 2.0
357 stars 139 forks source link

[Bug] Decimal points not showing in the reports response body if they are all zeroes #280

Open edwardjong opened 4 years ago

edwardjong commented 4 years ago

When I run a Newman test with the option for an HTMLEXTRA report, I get the a html outputfile which shows the amount fields without zeroes behind the decimal point in the response body. Running the same test in Newman with the option for CSV output I DO get the zeroes.

HTML output: image

CSV output image You can see the difference between HTML and CSV output

Investigating the HTML file: Google Chrome - Inspect - Sources image The zeroes are in the file, but the formatting is NOT ok

Version and Platform Information:

Newman run with HTMLEXTRA output: newman run -k "Claims-test.json" -d "Claims-data.csv" -e %env%.postman_environment.json -r htmlextra --reporter-htmlextra-logs --reporter-htmlextra-omitHeaders --reporter-htmlextra-hideRequestBody "PostApiGebruikersV1Login" --reporter-htmlextra-hideResponseBody "PostApiGebruikersV1Login"

Newman run with CSV output: newman run -k "Claims-test.json" -d "Claims-data.csv" -e %env%.postman_environment.json -r csv --reporter-csv-includeBody

Additional Context

Running the test in the Postman Collection Runner also shows me the zeroes.

edwardjong commented 4 years ago

Inspect sources

DannyDainton commented 4 years ago

From what I know about Matt's CSV reporter is that he's taking the stream response and converting that to a string before adding it to the final CSV file.

That's not really what I'm doing here as I'm pretty printing the JSON response and I think that JSON.stringify() is doing something weird with floating point numbers that end .00

I need to get some time to take a look at this closer.

praveendvd commented 3 years ago

From what I know about Matt's CSV reporter is that he's taking the stream response and converting that to a string before adding it to the final CSV file.

That's not really what I'm doing here as I'm pretty printing the JSON response and I think that JSON.stringify() is doing something weird with floating point numbers that end .00

I need to get some time to take a look at this closer.

Hi danny i looked into this , the issue is caused by JSON.parse(data) in prettyprint class. Should we be formatiing the response send by server ?

DannyDainton commented 3 years ago

I did have a look at the and tried a few things without that being there but there are a few other issues.

That is more about decorating the reports request and response body in the correct way and could be handled differently but I don't have time to dig deeper into all the other things that could potentially break as a result of removing it 😔