Functional Testing Quickstart
This guide walks you through running your first functional test with NAT: sign up, get your API key, run a functional scan, and view visual regression, accessibility, and performance results — all in under 10 minutes.
Functional testing is available on Pro and Team plans. Start a free trial (opens in a new tab) — no credit card required for the first 14 days.
Sign up and get your API key
Navigate to app.nat-testing.io/signup (opens in a new tab) and create your account. Once your account is provisioned, retrieve your API key:
- Go to app.nat-testing.io/dashboard (opens in a new tab)
- Click Settings → API Keys
- Copy your key (starts with
nat_pk_)
Export it as an environment variable for use in all examples below:
export NAT_API_KEY="nat_pk_your_api_key_here"Store your API key securely. Never commit it to source control — use environment variables or a secrets manager instead.
Install NAT (CLI users)
If you prefer the command-line interface, install the NAT engine:
pip install nat-engine
nat auth login --key $NAT_API_KEY
nat --versionPython 3.9+ is required. Use Python 3.11+ for best performance. See the Installation guide for Docker and virtual environment setup.
Run your first functional test
Choose the CLI or API approach:
# Run functional tests on your app
nat scan --url https://app.example.com --mode functional
# Run security + functional tests together
nat scan --url https://app.example.com --mode full \
--spec ./openapi.json
# Fail pipeline if performance score < 70 or accessibility violations exist
nat scan --url https://app.example.com --mode functional \
--fail-on performance:70 --fail-on accessibility:anyResponse:
{
"scan_id": "scan_ft_abc123xyz",
"status": "running",
"mode": "functional",
"created_at": "2025-01-15T10:30:00Z"
}Save the scan_id — you will need it to poll for results.
Poll for scan completion
The CLI handles polling automatically. Results print to the terminal when the scan completes:
nat scan --url https://app.example.com --mode functional
# NAT automatically polls and prints results when completeView visual regression results
Once the scan is complete, fetch the visual regression report to see before/after screenshots and pixel-diff analysis:
nat results --scan $SCAN_ID --type visual-regression
# Or open the interactive HTML report:
nat results --scan $SCAN_ID --export html --openView accessibility results
Fetch the full WCAG compliance report with violation details and per-page scores:
nat results --scan $SCAN_ID --type accessibilityView performance metrics
Retrieve Core Web Vitals and performance scores for all tested pages:
nat results --scan $SCAN_ID --type performanceRunning security and functional tests together
Use "mode": "full" (API) or --mode full (CLI) to run both security scanning and functional testing in a single scan run:
nat scan --url https://app.example.com \
--mode full \
--spec ./openapi.json \
--fail-on highThe combined scan result contains both tasks (security findings) and visual_regression, accessibility, and performance sub-reports.
Integrate with CI/CD
Add functional testing to your pipeline with a single step:
# GitHub Actions example
- name: Run NAT functional tests
run: |
pip install nat-engine
nat scan \
--url ${{ secrets.STAGING_URL }} \
--mode functional \
--fail-on accessibility:critical \
--fail-on performance:60
env:
NAT_API_KEY: ${{ secrets.NAT_API_KEY }}Use the GitHub Action reference for the official nat-action which handles installation, caching, and result annotation automatically.
Next steps
- Functional Testing API Reference — full request/response schemas for all functional testing endpoints
- Functional Testing Overview — learn how visual regression, accessibility, and performance testing work
- API Quickstart — API-first onboarding including security scanning
- CI/CD Integration — automate tests in GitHub Actions, Jenkins, and more
- Troubleshooting — solutions for common functional testing issues