In the User Service collection, there are several tests ran and each test will add +1 to a failed postman variable.
At the “Teardown - User Service (Password Tests)” I check the “failed” Postman Variable and if it’s value is equal to 0 then I use Postman Set Next Request to tell Postman to end the test there and not go to the next request (The Slack request just messages me on Slack saying “X tests have failed for the Y Test Collection”
This means I can have this test run in a Postman Monitor or in our CI and I get notified instantly on Slack for any deviations.
TBH, I probably don’t need to tell Postman to go to the Slack request if the failed value is greater than 0, as by default Postman will go to the next request anyway xD
I should also point out, my Setup/Teardown requests are just hitting the below endpoint which just waits X seconds depending on the numerical value you enter. I obviously enter “0”
Wrap the tests for TypeA and TypeB themselves in an if block, so they are directly aware of whether or not they should run. If the test “runs,” but it’s not its turn, it will just return green.