Skip to navigation

Run API tests in your CI/CD pipeline using Postman

View as Markdown

With continuous integration and continuous delivery (CI/CD), the goal is to deliver frequent software updates that provide value for users. At the same time, it’s important to maintain software quality. Running API tests automatically during the build process helps ensure that every code change is ready for production.

The Postman CLI enables you to run your test collections, monitors, flows, and more as part of your CI/CD pipeline. With the Postman CLI, you can run your tests and monitor their results every time there’s a push to your code repository.

Configure Postman CLI test runs

To run tests as part of the CI/CD pipeline, first create a Postman Collection with the tests you want to run. Then use Postman to generate a code snippet you can include in your CI/CD pipeline configuration. The Postman CLI runs your tests each time the pipeline runs. This enables you to push or roll back your changes based on the test results.

To configure your CI/CD pipeline to run a collection, do the following:

  1. Click Items icon Items in the sidebar.
  2. Click Collections and select the collection or folder you want to run in your CI/CD pipeline.
  3. Click Run icon Run.
  4. On the Functional tab, click Configure CI/CD.
  5. Click Set up CI/CD.
  6. Select the collection you want to run and an optional environment. You can click Add icon Add Another Collection to include multiple collections.
  7. Select your CI/CD Provider and Operating system.
  8. Click Copy icon Copy or Copy Postman CLI Command to copy the configuration, then add it to your CI/CD pipeline script.

To learn more about configuring the Postman CLI in your CI/CD pipeline, see Postman CLI commands and options overview.