hitspec contract
Verify API contracts against a live provider.Arguments
Flags
Contract Annotations
Define contract metadata using annotations in your.http files:
State Handler
The--state-handler flag specifies a script that sets up provider state before each interaction. The script receives the state description as an argument:
Examples
Sample Output
Use Cases
- Consumer-driven contracts — Define what your service expects from its dependencies, then verify those contracts against the real provider.
- API versioning — Ensure that provider changes do not break existing consumers.
- CI/CD gates — Run contract verification as part of the provider’s deployment pipeline.
hitspec diff
Compare two JSON test result files to identify regressions, improvements, and changes between test runs.Arguments
Flags
How It Works
The diff command compares tests by name and file, then categorizes each as:Generating Input Files
First, generate JSON results from your test runs:Examples
Console Output
Threshold Check
When--threshold is set, the command exits with a non-zero status if any test’s duration increases by more than the specified percentage. This is useful for catching performance regressions in CI: