How do I run tests for an API?

The documentation explains how to create tests for an API but says absolutely nothing about running those tests. E.g. once I’ve added a “contract test” to the API, how do I get it to run and validate the defined schema?

Welcome to the community!

Whenever you send a request within Postman, any tests attached to that request will run. This is how you can execute tests on a request by request basis.

If you use the Runner, then you can execute all the tests within a collection in one hit.

Hi guys, you seem to be talking about creating tests for a request/collection. But I asked about the new “API” functionality that has just been added. Through the UI I can add “contract tests” and “integration tests” to the API, but how do I run them?

Hi @jon.r,

This is to clarify that the test suite along with contract tests and the integration tests that are added to a specific API are always associated with a specific collection as you can see in the attached image

.

As mentioned in an earlier message, you can run the “contract tests” and “integration tests” to the API by navigating to the Collections tab and executing the Runner on the collection you specified for the test suites in the API tab.

@amir.ahmed If I got to the collections runner there is no mention whatsoever of “contract tests”, “integration tests” or any test “suites” at all.

  1. Please explain EXACTLY what is a test suite is, how I can add a test to a particular suite, and how I can run a particular suite in isolation, or, better yet, point me to some Postman documentation explaining this.

  2. Please explain EXACTLY what the point of defining a “test suite” on the APIs page is, if I cannot open them from there, cannot edit from there, cannot run them from there, and they do absolutely nothing else, or, better yet, point me to some Postman documentation explaining this.

Because as far as I can tell, right now the entire “APIs” tab is placeholder UI that has been included in the app for no reason, and serves no useful purpose at all.

Hi @jon.r,

Ideally speaking, you are naming and organising the collections into a Contract Test collection, Integration Test collection, Test suite collection etc, then you add those collections to the appropriate sections of the Test subtab on the API tab.
By doing this, you have created an association between a specific API schema and the different collections linked to it, each collection having different functions and responsibilities.
For further information on the API workflow, I would take a look at the following link: