Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman Collection Runner returns "No test" when running tests

I want to test the collection Test Server in Postman Collection Runner. However, when I run my tests they don't respond with a pass or fail. Postman only displays "No test" as a result.

Why are my tests returning "No test" in the Postman Collection Runner? How do I run my tests?

Collection Runner returning "No tests"

like image 528
Toi Nguyen Avatar asked Jul 14 '16 04:07

Toi Nguyen


People also ask

How do you add tests in Postman runner?

Adding tests You can add tests to individual requests, collections, and folders in a collection. Postman includes code snippets you add and then change to suit your test logic. To add tests to a request, open the request and enter your code in the Tests tab. Tests will execute after the request runs.

How do you log a response body in the Postman collection runner?

Open the collection runner, Select the required collection and request, select the “save responses” checkbox and run it. click on individual request, select the response body and manually copy the response and paste it to locally which is not feasibly because we can't do manually one by one for 100 requests.

How do I export my Postman Runner results?

You can get this information from the Runner but clicking on the Request Name , which will display those details. To export the whole run results into a file, which would contain all the information, you would need to use Newman to run the collection file from the command line.


1 Answers

Like previously mentioned, you need to write some tests for your requests in order to see these being executed in the Collection Runner. Without these, all the runner is doing, is just sending requests to the endpoints specified in your collection.

An example of a basic status code check:

pm.test("Status code is 200", function () {
   pm.response.to.have.status(200);
});

This can be added to the Tests section of the request builder:

enter image description here

More information can be found in the Postman Documentation about writing tests in your requests. Some more basic test examples can also be found on this page.

Postman have recently added the ability to create tests at the Collection and sub-folder level, to help to reduce the amount of test repetition - Checking for a response status code is a potential candidate that could be applied at the Collection level and be run against all of your requests, from a single location. More details can be found in this Postman blog post.

like image 183
Danny Dainton Avatar answered Sep 18 '22 13:09

Danny Dainton