how to append newman htmlextra results to existing htmlextra report file

与世无争的帅哥 提交于 2020-03-25 19:18:10

问题


i have two newman commands

  1. newman run collection.json -e env.json --folder create_clients -d clients.csv -r htmlextra --htmlreporter-export reporter.html

  2. newman run collection.json -e env.json --folder create_orders -d orders.csv -r htmlextra --htmlreporter-export reporter.html

after command #2 is executed reporter.html is overwritten, i want results to be appended.

is there any possibility, please suggest, Thanks.


回答1:


The reporter doesn't work in that way. You cannot append the results from a previous run as it creates a brand new report again.

Contextually, those are 2 different Collection runs. It would be the same if you were to run those in the app and see the results in the Runner.

If you wanted to see both reports individually, you would need to give them a different name, when exporting, or remove the export flag and the default filename would be created in the /newman directory.




回答2:


The --htmlreporter-export reporter.html parameter says to newman to save the html report in a file called reporter.html, so each time you run your command, this file is overwriten.

If you need to save your file with a different name, you can try to add a timestamp to it's name. On unix system, you can try something like :

--htmlreporter-export reporter-`date +'%y-%m-%d-%H-%M-%S'`.html

This will append the output of the date command (formated in a Year-Month-Day-Hour-Min-Sec number string) in the file name, so if your commands runs more than one second, each result will be in a different file (you can of course add -%N to have nano seconds, or man date to seek other usefull values !).

But, you know, using standard outputs is a good practice : everybody using newman expect results to be found as newman/newman-run-report-[date].[json|xml|html], so unless you have an uncommun need to get the result elsewhere, Keep It Simple, and don't reinvent the wheel :-)



来源:https://stackoverflow.com/questions/58914674/how-to-append-newman-htmlextra-results-to-existing-htmlextra-report-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!