Menu

A Stopwatch Needs an Isolated Lane
📰

A Stopwatch Needs an Isolated Lane

DEV Community: dotnet·Ivan Rossouw·19 days ago
#RxMqN3nS
#devtodotnet#devto#dev#test#timing
Reading 0:00
15s threshold

Timing tests look wonderfully objective. Start a stopwatch, call the component, stop the watch, and compare the result with a budget.

The number is precise. The experiment may not be.

That distinction matters in continuous integration, where many tests share CPU time, thread pools, network stacks, containers, and database capacity. A wall-clock assertion can fail because the product became slower. It can also fail because the test runner became busier. If we cannot distinguish those two explanations, the test is producing urgency without producing useful evidence.

The contract was reasonable

Consider a service with separate liveness and readiness checks. Liveness says the process is still running. Readiness says the instance can safely accept work.

One integration test deliberately points the service at an unreachable dependency. The expected behavior is not success. The service should return an unavailable response, and it should do so within a fixed upper bound.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.