Skip to main content

Continuous Integration

TestRadar supports all modern CI providers. The following is a growing list of examples. Don't worry if your provider isn't listed. While the syntax for configuring your CI may be a little different, the steps are the same.

  1. To communicate with TestRadar, store your API key as a secret with your CI provider and set the TESTRADAR_API_KEY environment variable to be read from process.env by each plugin.

    danger

    Your API key should be treated as a secret. Don't share it with others or store it in plain text.

  2. For most CI providers, the git branch the pipeline is running for will be determined automatically, but for some it will not. If it cannot be automatically determined your test run will fail with ValidationError... "branch" is required. To fix this, simply set the TESTRADAR_BRANCH environment variable manually. We recommend you skip this step for now because odds are your git branch will be determined automatically.

The following examples run all tests when changes are pushed to the main branch.

For information on our recommended workflow, see "Recommended Workflow".

GitHub Actions

name: Main

on:
push:
branches: ['main']

env:
TESTRADAR_API_KEY: ${{ secrets.TESTRADAR_API_KEY }}

jobs:
unit-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm ci
- run: npm test

e2e-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cypress Run
uses: cypress-io/github-action@v6
with:
command: npm run e2e