Continuous Integration and Continuous Delivery (CI/CD) are a core component of the API development workflow. Postman integrates with popular CI tools so you can view details about API builds in the same place where you define and test your API.
After you set up CI integration, you can view the status of builds or kick off a new build, all from within Postman. In addition, with the help of Newman and the Postman API, you can run API tests created in Postman as part of your CI pipeline.
To set up CI integration for your API, you’ll need to create an API token in your CI tool and configure your API in Postman. See the instructions for your CI tool:
After you set up CI integration, status information for CI build jobs is available in Postman. For each build you can view the commit message, the branch the build ran on, the build status (success or failed), and the time the build ran.
To view build jobs, open your API and select the Test tab. The most recent jobs are listed under Recent Runs.
- To view a build in your CI tool, hold the cursor over a build and select View build details.
- To kick off a new build, select Run Build. Select or type a branch name, and then select Run Build.
- To edit or delete the integration, select the three dots .
To view the full list of build jobs, select View All Builds. Use the dropdown list to filter the list of builds by branch or view builds for All Branches. To get the latest build status information, select Refresh.
Running API tests as part of your CI pipeline helps to ensure that expectations between your API producers and consumers stay in sync.
To run your API tests along with each build, first generate the required Newman configuration code in Postman. Then add the configuration code to your CI tool. After configuration, each time a CI build runs, Newman uses the Postman API to run the collections that contain your tests. You can view the results of your tests in Postman.
Before you begin, make sure you’ve already set up an integration between your API and CI tool.
To generate configuration code for Newman:
- Open your API and select the Test tab.
- Under Recent Runs, select View All Builds.
- Select Configure Newman.
- Select a Collection and Environment to run during CI builds.
- (Optional) Select + Add more to select additional collections to run.
- Select Copy to copy the Newman configuration, and then select Finish.
- Add the Newman configuration you copied to the build configuration file in your API repository. See the instructions for your CI tool: