stress your tests
Most integration tests can be load tests. I don’t see this done enough.
Good testing advice is clear. "Write tests. Not too many. Mostly integration." I add a layer: most tests can be stress tests. Or load tests, if you prefer.
A load test is not defined by tooling, but by intent. It saturates a constrained resource (CPU, memory, disk, network) until limits are reached. Assertions move past correctness and into stability, throughput, latency, failure modes.
Integration needs to be reproducible in ci. Load tests are often excluded because they are considered noisy, slow, or irreproducible. I don’t think integration tests are inherently any of those. When they are, it is usually a design failure. Well-designed integration tests are:
- Deterministic
- Reproducible
- Idempotent
In practice, the difference is configuration:
test(iterations=1, size=1, seed=42, start_time=0)
Now, let's saturate a resource by growing the iterations.
test(iterations=10_000, size=1, seed=random(), start_time=now())
Or by increasing the input size:
test(iterations=1, size=42, seed=random(), start_time=now())
This means you don't maintain tests twice. The "best" programming language is often the one you are currently using. The same applies to testing.
Stress your tests.