Back to Blog
Tutorial

CI/CD Integration Guide: Automate Your Test Runs

Integrate Qualigate into your CI/CD pipeline with API keys, the REST API, and GitHub Actions. Run tests on every push, pull request, or on a schedule.

Qualigate TeamDecember 5, 20259 min read

Why Integrate Testing into CI/CD?

Running tests manually after each deployment catches bugs---but only if someone remembers to do it. Integrating Qualigate into your CI/CD pipeline ensures that every push, every pull request, and every scheduled deployment goes through your quality gate automatically.

This guide covers three integration methods: the REST API, the Qualigate CLI, and a ready-to-use GitHub Actions workflow.

Step 1: Generate an API Key

Before any integration, you need an API key:

  1. Log in to Qualigate and go to Settings > API Keys
    • Click Generate New Key
    • Name it descriptively (e.g., "GitHub Actions CI" or "Jenkins Pipeline")
    • Copy the key---it starts with qg_ and is only shown once
    • Store it as a secret in your CI/CD platform
In GitHub: Go to your repository Settings > Secrets and variables > Actions, and add a new secret named QUALIGATE_API_KEY.

Step 2: Trigger Tests via the REST API

The core endpoint is POST /api/v1/trigger. You can trigger a single test case, an entire test suite, or all tests in a project.

Trigger a Single Test

bash
curl -X POST https://qualigate.app/api/v1/trigger \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "test_case_id": "your-test-case-uuid",
    "context": {
      "source": "github-actions",
      "branch": "main",
      "sha": "abc123"
    }
  }'

Trigger an Entire Suite

bash
curl -X POST https://qualigate.app/api/v1/trigger \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "test_suite_id": "your-suite-uuid"
  }'

Trigger All Project Tests

bash
curl -X POST https://qualigate.app/api/v1/trigger \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "your-project-uuid"
  }'

The response includes a test_run_id (or test_run_ids for batch triggers) that you use to poll for results.

Step 3: Poll for Results

Tests run asynchronously in the background. Poll the status endpoint until the test completes:

bash
curl https://qualigate.app/api/v1/trigger?test_run_id=YOUR_TEST_RUN_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

The status field transitions through: pending > running > passed | failed | error | timeout.

Recommended polling interval: 10 seconds. Avoid polling faster than every 5 seconds to stay within the 30-request-per-minute rate limit.

Step 4: GitHub Actions Workflow

Here is a production-ready GitHub Actions workflow that runs Qualigate tests on every push to main and on pull requests:

yaml
name: E2E Tests (Qualigate)

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  e2e-tests:
    name: Run E2E Tests
    runs-on: ubuntu-latest
    steps:
      - name: Trigger Qualigate Tests
        id: trigger
        run: |
          RESPONSE=$(curl -s -X POST https://qualigate.app/api/v1/trigger \
            -H "Authorization: Bearer ${{ secrets.QUALIGATE_API_KEY }}" \
            -H "Content-Type: application/json" \
            -d '{
              "test_suite_id": "${{ vars.QUALIGATE_SUITE_ID }}",
              "context": {
                "source": "github-actions",
                "branch": "${{ github.ref_name }}",
                "sha": "${{ github.sha }}",
                "pr_number": "${{ github.event.pull_request.number }}",
                "repository": "${{ github.repository }}"
              }
            }')
          echo "response=$RESPONSE" >> $GITHUB_OUTPUT
          SUITE_RUN_ID=$(echo $RESPONSE | jq -r '.suite_run_id // .test_run_id')
          echo "run_id=$SUITE_RUN_ID" >> $GITHUB_OUTPUT

      - name: Wait for Results
        id: results
        run: |
          RUN_ID="${{ steps.trigger.outputs.run_id }}"
          for i in $(seq 1 60); do
            RESULT=$(curl -s \
              -H "Authorization: Bearer ${{ secrets.QUALIGATE_API_KEY }}" \
              "https://qualigate.app/api/v1/trigger?suite_run_id=$RUN_ID")
            STATUS=$(echo $RESULT | jq -r '.status')
            echo "Attempt $i: status=$STATUS"
            if [ "$STATUS" = "completed" ] || [ "$STATUS" = "passed" ] || [ "$STATUS" = "failed" ]; then
              echo "result=$RESULT" >> $GITHUB_OUTPUT
              PASSED=$(echo $RESULT | jq -r '.passed_tests // 1')
              FAILED=$(echo $RESULT | jq -r '.failed_tests // 0')
              echo "passed=$PASSED" >> $GITHUB_OUTPUT
              echo "failed=$FAILED" >> $GITHUB_OUTPUT
              if [ "$FAILED" -gt 0 ]; then
                echo "E2E tests failed: $FAILED test(s)"
                exit 1
              fi
              exit 0
            fi
            sleep 10
          done
          echo "Tests timed out after 10 minutes"
          exit 1

Setup:

  1. Add QUALIGATE_API_KEY as a repository secret

    • Add QUALIGATE_SUITE_ID as a repository variable (Settings > Variables)

    • Commit the workflow file to .github/workflows/e2e.yml


Scheduled Test Runs

Beyond CI triggers, Qualigate supports scheduled test runs directly from the dashboard. Go to your test suite settings and configure a cron schedule:

  • Every hour for critical paths (login, checkout)
  • Every 6 hours for secondary flows
  • Daily for full regression suites
Scheduled runs execute independently of your CI/CD pipeline and send email alerts on failure, so you catch environment issues and third-party API outages even when no one is deploying.

Batch Execution and Parallelism

When you trigger a project or suite, all test cases within it are queued simultaneously. Qualigate executes them in parallel (subject to your plan's concurrency limit), so a suite of 10 tests does not take 10 times as long as a single test.

To batch-trigger specific test cases, use the bulk endpoint:

bash
curl -X POST https://qualigate.app/api/test-runs/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "test_case_ids": ["uuid-1", "uuid-2", "uuid-3"],
    "project_id": "your-project-uuid"
  }'

Best Practices for CI/CD Integration

  1. Use separate API keys for each environment (staging, production, local) so you can rotate them independently.
    • Include CI context (branch, SHA, PR number) when triggering tests. This metadata appears in the Qualigate dashboard and makes it easy to trace failures back to specific commits.
    • Set a reasonable timeout in your workflow. Most Qualigate tests complete in 1--3 minutes, but complex flows may take up to 5 minutes.
    • Fail the build on test failure. Do not gate deployments on manual review of test results---let the pipeline enforce quality automatically.
    • Monitor credit usage. Each test run consumes credits. Check your credit balance in Settings > Billing and set up alerts to avoid running out mid-sprint.

Automate your quality gate today. Get started free and integrate Qualigate into your pipeline in 10 minutes.

Tags

ci-cdautomationapigithub-actions

Ready to Transform Your Testing?

Experience AI-powered testing that writes itself. Start free and see results in minutes.

Start Free Trial