Prompt

How do I run API tests in CI/CD with GitHub Actions?

Technology / Testing & QA1 observationLast seen Oct 6, 2026

Latest observation

Oct 6, 2026OpenAI APIWeb search: off

You can run API tests in GitHub Actions by adding a workflow that:

  1. checks out your code,
  2. starts any required services,
  3. installs dependencies,
  4. runs your API test suite,
  5. reports the result back to GitHub.

Typical setup

1) Put your API tests in the repo

Common tools:

  • Postman/Newman
  • pytest + requests
  • Jest + supertest
  • Playwright API testing
  • Karate

2) Create a GitHub Actions workflow

Example for a Node.js project using Newman:

name: API Tests

on:
  push:
    branches: [main]
  pull_request:

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

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Run API tests
        run: npx newman run tests/postman_collection.json -e tests/env.json

If your API needs a running backend

If the API under test must be started in CI, use a service container or start the app first.

Example: start app, then test it

name: API Tests

on: [push, pull_request]

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

    steps:
      - uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Start API server
        run: npm start &

      - name: Wait for API
        run: npx wait-on http://localhost:3000/health

      - name: Run tests
        run: npm test

Example with Docker Compose

If your API depends on a database or Redis:

name: API Tests

on: [push, pull_request]

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

    services:
      postgres:
        image: postgres:16
        env:
          POSTGRES_USER: test
          POSTGRES_PASSWORD: test
          POSTGRES_DB: testdb
        ports:
          - 5432:5432
        options: >-
          --health-cmd="pg_isready -U test"
          --health-interval=10s
          --health-timeout=5s
          --health-retries=5

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Install dependencies
        run: pip install -r requirements.txt

      - name: Run tests
        env:
          DATABASE_URL: postgresql://test:test@localhost:5432/testdb
        run: pytest tests/api

Best practices

  • Run tests on pull requests and main branch pushes.
  • Use secrets for credentials:
    env:
      API_KEY: ${{ secrets.API_KEY }}
    
  • Make tests idempotent and independent.
  • Add a health check before testing.
  • Publish test reports if needed.
  • Separate smoke tests (fast) from full regression tests.

Useful additions

  • Artifacts: upload logs or reports
  • Matrix testing: run against multiple environments
  • Environment-specific configs: dev/staging/test

Example artifact upload:

- name: Upload test report
  uses: actions/upload-artifact@v4
  with:
    name: api-test-report
    path: reports/

If you tell me your stack (Node, Python, Java, Postman, Docker, etc.), I can give you a ready-to-use workflow file.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.