.NET Testing Techniques You Didn’t Know You Needed - Dante De Ruwe - NDC Copenhagen 2026
This talk explores advanced .NET testing techniques designed to improve test effectiveness and build confidence in code quality beyond basic unit tests. Key methods include Property-Based Testing (PBT) for generating vast input variations, Snapshot Testing for tracking complex output changes over time, and Mutation Testing for verifying if existing tests are actually capable of catching bugs. The speaker emphasizes that the goal is not just to write many tests, but to write fewer, highly effective tests.
Key takeaways
-
Test Reliability vs. Code Trust
2:00
Tests should be viewed as a 'parachute'—they must have no holes. A failing test when requirements haven't changed indicates a bug; passing when the code changes suggests incomplete coverage or potential issues.
-
Randomized and Property-Based Testing (PBT)
7:10
Instead of relying solely on example cases, PBT defines mathematical properties that the code must always satisfy (e.g., a + b = b + a). This is crucial for complex structures or when edge case enumeration is impossible.
-
Snapshot Testing
13:20
This technique captures and saves the output of a function (the 'snapshot'). Subsequent test runs fail if the output changes unexpectedly, making it ideal for verifying API contracts (like OpenAPI specs) or complex data structures without writing explicit assertions for every field.
-
Mutation Testing
26:20
This advanced technique introduces small bugs (mutations) into the code and checks if the existing test suite fails. A high mutation score indicates that tests are effective at catching subtle errors, debunking false confidence from high line coverage metrics.