I like to know what is the structure to create a setup and teardown
I like to have a single collection.json that run my various test cases
so I will probably call sendNextRequest
but before I run the next testcases, I need to cleanup my current testcases?
if I don’t use the above method, how can I produce a single report?
here I have 1 testcase collection
newman run /tmp/collection/TC1.collection.json -e /tmp/environment/postman_stella_dev.json -g /tmp/environment/postman_globals.json -d /tmp/testdata/TC1.json --reporters=“cli,htmlextra” --reporter-htmlextra-export /tmp/report/report.html
if I have another testcase TC2 collection
I run the above same newman command but it is another report.html
how can I run all my testcases TC1, TC2 and produce 1 single report.html?
What do you mean by “I need to cleanup my current testcases”, define “cleanup”. Do you mean clear all persisting environment variables from your last run?
If so, here’s how I’m doing something similar:
Here’s how I’m doing it:
Looking at the above image, I have a “Hooks: Before Each” collection folder.
What I do is, I want all the requests in that folder to run, and then it’ll go to the “[A1] Create” folder.
Once all the requests in “[A1] Create” have run, I use the setNextRequest command to go back to my “Before Each” folder which clears all environment variables so I’ll have no persisting data from previous test runs. (I also have other requests in this before each hook)
Once all the requests in the Before Each folder have run, I use setNextRequest to go to the “[A2] Overdue” folder instead of naturally going to “[A1] Create”
I keep repeating this so before a collection is run, the environment variables get cleared.
Once the 2nd to last collection has finished running “[A4] Operation: Resolve”, I go to the last collection “[AX] Done” which just clears all environment variables.