Fail the script when there are no tests

Take an example, I don’t have any tests. Instead of seeing No tests found, I would like to fail the test. Is there any way to do this??

Logically, if you don’t have any tests, then “no tests found” is correct.

You could in theory create a separate request that uses the Postman Collection API to loop through all of the requests in a Collection to see if there are any tests.

Please have a look at the 15-days-of-postman-for-testers/ collection for examples on how to check for the existence of tests. Have a look at the submit your solution requests.

However, its fairly complicated and requires a base level understanding of Javascript and I’m not sure of the value of the test. You are just testing that someone has created tests, instead of testing the actual application\API. What’s next? Testing that the actual tests that are created are correct?

This sounds like an activity that can be done via peer review or some other method that doesn’t require you writing lots of code.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.