Prerequisites
- A GitHub repository
- hitspec test files in your repo (see Basic CRUD)
Quick Setup with the Official Action
The fastest way to run hitspec in CI is with the official GitHub Action.1
Add test files to your repo
Create a
tests/ directory with your .http files:tests/api.http
2
Create the workflow file
Create The
.github/workflows/api-tests.yml:.github/workflows/api-tests.yml
if: always() on the upload step ensures test results are uploaded even when tests fail, so you can inspect failures in the GitHub UI.3
Verify the results
When the workflow runs, it:
- Installs the latest hitspec binary
- Runs all
.httpfiles in thetests/directory - Produces JUnit XML output at
test-results.xml - Exits with code 0 on success, 1 on failure
- Uploads the XML as a build artifact
Workflow Recipes
Run only smoke tests
Filter by tags to run a fast subset in CI:Run tests against staging
Use theenv input to select an environment defined in the environments section of your hitspec.yaml:
Pass secrets via environment file
Create a.env file at runtime from GitHub secrets:
Parallel execution
Run independent tests concurrently for faster feedback:Fail fast on first error
Usebail to stop at the first failure:
Stress testing in CI
Run load tests with pass/fail thresholds as a quality gate:Manual Installation (Without the Action)
If you prefer to install hitspec yourself:Exit Codes
hitspec uses standard exit codes for CI integration:
CI platforms treat any non-zero exit code as a failure, so hitspec works out of the box with GitHub Actions, GitLab CI, CircleCI, Jenkins, and others.
Environment Variables
All CLI flags can be set via environment variables with theHITSPEC_ prefix. This is useful for CI where you want to configure hitspec without modifying the workflow:
Complete Production Workflow
Here is a full workflow that runs smoke tests on every push, full tests on PRs, and stress tests on merge to main:.github/workflows/api-tests-full.yml
Next Steps
Output Formats
Learn about JUnit, JSON, TAP, and HTML output options.
Stress Testing
Configure load tests with profiles and thresholds.