Postman Collection Runner returns "No test" when running tests
Asked Answered
J

6

12

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"

Junejuneau answered 14/7, 2016 at 4:8 Comment(0)
P
3

Or... maybe @Toi meant that you've written tests for your requests in that collection & the tests correctly give you passes & fails when run on their own, but then running your tests as a suite in Collection Runner doesn't give you any info about having run your tests(?) That's what I'm currently figuring out (again). Check it https://learning.getpostman.com/docs/postman/collection_runs/starting_a_collection_run/#collection-or-folder

Pinkham answered 24/5, 2019 at 15:56 Comment(1)
That's exactly what's happening to me now. Did you find any solution? I didn't find anything on it in the link you posted. Thanks! – Nimbus
S
14

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.

Sweetening answered 28/12, 2017 at 10:45 Comment(2)
writing test link is broken. Should be this one, I guess, learning.postman.com/docs/writing-scripts/test-scripts/… – Randalrandall
Edited the answer. πŸ† The other link was also broken - We have changed and restructured the learning center a few times in the last 6/7 years πŸ˜‚ – Sweetening
P
3

Or... maybe @Toi meant that you've written tests for your requests in that collection & the tests correctly give you passes & fails when run on their own, but then running your tests as a suite in Collection Runner doesn't give you any info about having run your tests(?) That's what I'm currently figuring out (again). Check it https://learning.getpostman.com/docs/postman/collection_runs/starting_a_collection_run/#collection-or-folder

Pinkham answered 24/5, 2019 at 15:56 Comment(1)
That's exactly what's happening to me now. Did you find any solution? I didn't find anything on it in the link you posted. Thanks! – Nimbus
Z
2

You need to write test script for these request. For example in request for google page test you need to write test script as

tests["status code is 200 : OK"] = responseCode.code === 200;

this will return if it hits the page and status is 200

Similarly you can write test cases for every request and run the collection, you will get count for pass or fail

Zoophobia answered 19/8, 2016 at 12:16 Comment(0)
M
2

Just click on Save near the Send request. This will show up the no of test pass/fail etc

Markup answered 22/7, 2019 at 18:18 Comment(0)
W
1

if you wrote test for your request, and when you run it individually everything is ok but when you run the whole collection from collection runner and you receive error or 0 as a result :

Your server is probably running on some another port which you not expect. and this is mostly happen when you are using proxy. so check your network to see if any proxy sets and close it.

for example you may always listening on port : 4000 but if you connect with vpn this might change to something like port : 3453.

you might find this link useful. i had your problem and could solve in from this page.

And also before everything, make sure you save all your changes like when you add a test, make sure you click on save button.

Wedgwood answered 29/7, 2020 at 17:14 Comment(0)
C
0

In my case I had to create a Postman Environment (in the menu between APIs and Mock Servers). Once it was created, assigned it to a collection (top right section). Then resent the request - test started to be executed.

Concordant answered 25/5, 2023 at 13:45 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.