Overview
HTTPSpec can be configured through environment variables to control runtime behavior, particularly around parallel test execution.Environment Variables
HTTP_THREAD_COUNT
Number of threads in the thread pool for parallel test file execution.Source:
main.zig:26Default Value
IfHTTP_THREAD_COUNT is not set or cannot be parsed as a valid integer, HTTPSpec defaults to 1 thread (single-threaded execution).
Valid Values
- Minimum:
1(single-threaded) - Maximum: Limited by system resources
- Recommended: Number of CPU cores or less
Configuration Examples
Single-threaded Execution (Default)
Multi-threaded Execution
One-time Configuration
CI/CD Pipeline
Performance Considerations
Thread Pool Architecture
HTTPSpec uses a thread pool to execute test files in parallel (frommain.zig:57-62):
Parallelization Strategy
File-level parallelization: Different test files run in parallel across threads.Request-level sequencing: Requests within a single file always execute sequentially, regardless of thread count.
- Variable assignments work correctly between requests
- Request dependencies are preserved
- Shared state within a file remains consistent
Choosing Thread Count
Benchmarking Example
Best Practices
Local Development
CI/CD Pipelines
Debugging Failed Tests
When debugging, use
HTTP_THREAD_COUNT=1 to ensure deterministic test execution order and easier-to-read output.Advanced Configuration
Dynamic Thread Count
Resource-constrained Environments
Troubleshooting
Invalid Thread Count
IfHTTP_THREAD_COUNT contains non-numeric characters, HTTPSpec falls back to the default:
Out of Memory
If you experience memory issues with high thread counts:See Also
- Run Command - Learn about test execution
- Parallel Execution - Optimize test suite performance