Skip to content

Run Tests

This guide shows you how to run tests in various scenarios and troubleshoot common issues.

  1. Navigate to the API directory

    Terminal window
    cd idx-api
  2. Run all tests with coverage

    Terminal window
    make test
  3. View the HTML reports

    Terminal window
    make test-html
    open reports/html/report.html
Terminal window
cd idx-api
# Run all tests with coverage
make test
# Run tests without coverage (faster)
make test-fast
# Run with HTML report generation
make test-html
Terminal window
# Run only authentication tests
make test-auth
# Run only unit tests
make test-unit
# Run only integration tests
make test-integration
# Run tests matching pattern
uv run pytest -k "auth" -v
# Run specific test file
uv run pytest tests/test_agents.py -v

During active development, use watch mode to automatically run tests when files change:

Terminal window
make test-watch
Terminal window
# Generate coverage with HTML report
make test-coverage
# Generate coverage for specific modules
uv run pytest tests/ --cov=idx_api.routers.agents --cov-report=html
# View coverage in terminal
uv run pytest tests/ --cov=idx_api --cov-report=term-missing

From the project root:

Terminal window
# Run tests in Docker container
make test-docker
# Run tests and publish to docs site
make docs-publish

Using Docker Compose directly:

Terminal window
# Run tests with the test profile
docker compose --profile test run --rm idx-api-test
# View test reports in docs dev server
docker compose --profile dev up idx-docs-dev
# Reports available at: https://help.{DOMAIN}/reports/tests/report.html

Test reports can be published to this documentation site for team visibility:

  1. Generate fresh reports

    Terminal window
    make test-html
  2. Publish to docs

    Terminal window
    make publish-docs
  3. Or combine both steps

    Terminal window
    make test-publish

Published reports are available at:

# GitHub Actions example with Docker
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests in Docker
run: make test-docker
- name: Build docs with reports
run: make docs-build
- name: Deploy docs
run: docker compose --profile prod up -d idx-docs
# GitHub Actions example (local)
- name: Run tests
run: |
cd idx-api
make test-html
- name: Upload reports
uses: actions/upload-artifact@v4
with:
name: test-reports
path: idx-api/reports/
Terminal window
# Ensure package is installed in dev mode
cd idx-api
uv pip install -e ".[dev]"
Terminal window
# Run single test with verbose output
uv run pytest tests/test_auth.py::test_api_key_validation -vvv
# Show print statements
uv run pytest -s
# Drop into debugger on failure
uv run pytest --pdb
# Show local variables in traceback
uv run pytest --tb=long