Getting Started

Set up integration testing in a new Python project in about five minutes.

1. Install

pip install snapline-core

Or clone the monorepo for demos and development:

git clone https://github.com/vaagatech/snapline-python.git
cd snapline-python
uv sync

2. Project layout

my_app_integration_tests/
├── fixtures/
│   ├── input.json
│   └── expected.json
├── tests/
│   └── test_user_sync.py
└── pyproject.toml

3. Fixtures

fixtures/expected.json

{
  "email": "alice@example.com",
  "status": "synced",
  "currentdate": "VALID_DATE"
}

4. First test

import asyncio
import os
from snapline.core import auth, test_suite

async def main():
    base_url = os.environ.get("API_BASE_URL", "https://your-api.com")
    result = await test_suite("User sync — API vs fixture", {
        "auth": auth.oauth2({
            "tokenUrl": f"{base_url}/oauth/token",
            "clientId": os.environ["CLIENT_ID"],
            "clientSecret": os.environ["CLIENT_SECRET"],
        }),
        "baseUrl": base_url,
        "api": {
            "endpoint": "/api/v1/user/sync",
            "method": "POST",
            "inputFile": "fixtures/input.json",
            "expectedFile": "fixtures/expected.json",
            "ignoreFields": ["pincode"],
            "transformations": {
                "currentdate": lambda v, _k, _p: (
                    "VALID_DATE" if isinstance(v, str) and v else "INVALID_DATE"
                ),
            },
        },
    })
    raise SystemExit(0 if result["passed"] else 1)

if __name__ == "__main__":
    asyncio.run(main())

5. Run

API_BASE_URL=https://staging.your-api.com \
CLIENT_ID=... CLIENT_SECRET=... \
python tests/test_user_sync.py

Run the repo demo (21 scenarios)

uv run demo              # all 21 scenarios
uv run demo-list         # list ids
uv run demo-run api-vs-file-graphql
python demo/run_all/run_all.py

Unit tests (maintainers)

uv sync
pytest tests -q
Next: End-to-End Guide for all test modes, fixture cases, and CI reports.