ervirendersingh / newman-reporter-allure

A newman reporter for generating nice and clean report using Allure-js framework
16 stars 27 forks source link

Keep same historyid value for each request #10

Open pauliehyland opened 4 years ago

pauliehyland commented 4 years ago

Hi,

I've noticed that the value of the historyid across the allure-results/XXX-result.json files for the same Postman request is getting allocated different historyid values on each execution, which is causing duplicates to appear in the report. Is it possible to fix this so that multiple runs of the same request always get the same historyid (perhaps taking it from the postman collection file)?

Perhaps something as simple as updating the beforeItem function within index.js to read:

_let allure_test = this.currentSuite.startTest(testName); allure_test.historyId = pmitem.name;

Or, even more robust, use the id of the request...

image

by implementing a helper function as per below...

_let allure_test = this.currentSuite.startTest(testName); alluretest.historyId = this.historyId(args.item); ... historyId(item) { return item.events.members[0].script.id; }

Thanks,

Paul

pauliehyland commented 4 years ago

Any thoughts @ervirendersingh or @ryparker?

ervirendersingh commented 4 years ago

As far as i remember, i had to do this to generate history and trends of past executions. the place where i deploy my allure report, i had to pull the history folder first, run tests and then generate report and then push it and then repeat again on next time when my build runs. this way history is maintained and shown correctly. if i give the same historyid, the test is shown under retries rather than a past execution. i'll try to push some some screenshots to prove this over the weekend. you can try forking and testing above code. let me know how it goes.

rahulrana1 commented 4 years ago

Thanks @ervirendersingh for writing this reporter. It does all I need. Just noticed the same issue, I too can't seem to find the history of the tests. Could you possibly be able have a look or suggest If i could be doing something wrong?

Newman version : 5.2.0 newman-reporter-allure: 1.0.7

Mik1Br commented 4 years ago

Hi, @pauliehyland have you been able to find fix for this problem or workaround? @ervirendersingh or @ryparker If I understood the issue correctly, I have the same problem while trying to re-run API tests: 1) Run tests using Newman with allure report using command: newman run collectionName -e environment -x --reporters cli,junit,allure --reporter-junit-export "report.xml" --reporter-allure-export "allure-results" 2) Find failed tests and extract them into new collection. (data is the same) 3) Run collection with failed tests using the same command: newman run collectionNameWithFailedTests -e environment -x --reporters cli,junit,allure --reporter-junit-export "report.xml" --reporter-allure-export "allure-results" 4) Generate allure report using command: allure generate allure-results -o allure_report --clean Actual result: Report contains 2 different results for the same tests: a) passed b) failed Expected result: there is only one result (the last one tried) for required test. Could please anyone suggest the solution?