Tdd Fundamentals · TL;DR
1 min readRapid overview
TL;DR
| Topic | Key Takeaway |
|---|---|
| Red-Green-Refactor | Discipline of small steps: fail, pass, improve |
| TDD vs Test-First vs Test-Last | TDD drives design; test-last is acceptable with discipline |
| xUnit | Modern default; [Fact]/[Theory], constructor lifecycle, parallel by default |
| AAA Pattern | Arrange-Act-Assert keeps tests readable and diagnosable |
| Mocking (Moq / NSubstitute) | Control inputs (stubs) and verify outputs (mocks) |
| Test Doubles | Know dummy/stub/mock/spy/fake — interviewers test vocabulary |
| Integration Testing | WebApplicationFactory for APIs; Testcontainers for real infra |
| Async Testing | Always use async Task; never .Result or .Wait() |
| Code Coverage | Target risk, not percentages; 100% is a vanity metric |
| BDD / SpecFlow | Living documentation for complex business rules |
| Anti-Patterns | Test behavior, not implementation; keep tests fast and focused |
| Property-Based Testing | Verify invariants over random inputs with FsCheck |
| Mutation Testing | Stronger quality signal than coverage; use Stryker.NET |