Travis CI

Travis CI is continuous integration (CI) platform that software development teams use to automatically build and test code changes. With Travis CI, developers can get immediate feedback on the success of a change.

To set up Travis CI integration for your API, you’ll need to create an API token in Travis CI and configure your API in Postman. After you set up the integration, you can view the status of builds or kick off a new build, all from within Postman.

Copying your Travis CI API Token

  1. Log into Travis CI and navigate to your account profile page.
  2. Select the Settings tab, and then select Copy Token.

Configuring Travis CI integration

  1. Open your API by selecting APIs in the left sidebar, and then selecting an API and a version. Each API version can be linked to only one CI project.

  2. Select the Test tab.

  3. Under Connect to CI/CD Builds, select Travis CI.

    CI Integration

  4. For API Key, enter your Travis CI token.

  5. Enter a Nickname to help you recognize the integration later.

  6. Select the CI project used for your API.

  7. Select Connect.

    Add API key

Configuring Newman for Travis CI

With the help of Newman and the Postman API, you can run API tests created in Postman as part of your CI pipeline. First generate the Newman configuration code in Postman. Then add the configuration code to Travis CI:

  1. Create a file named .travis.yml at the root of your project repository.
  2. Add the Newman configuration you copied from Postman to the .travis.yml file:
  3. Commit and push the changes to your remote repository.
  4. In Travis CI, open the repository from the dashboard. Then select More options > Trigger build.
  5. To view the test results in Postman, open your API and select the Tests tab.

Example Travis CI .travis.yml

language: node_js
- "12.18.3"

- npm install newman

- node --version
- npm --version
- node_modules/.bin/newman --version

- node_modules/.bin/newman run$KEY --environment$KEY

Last modified: 2021/11/01