Resource · Guide or article
Why Unit Tests
A short case for writing unit tests despite the extra effort, built around cost, confidence, speed and documentation. Useful when an interviewer asks why you test, or how you would persuade a team that skips tests.
Reviewed
Open the original: Why Unit Tests (opens the original site in a new tab)Add to a roadmap
Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.
Source content: English
It is no secret that writing unit tests is hard, and even harder to write well. Writing unit tests also increases the development time for every feature. So why should we bother writing them?
PrepKit overview
PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.
- Suited to
- The source does not state a level
- Format
- Article
What it covers
- Cites an IBM study the page dates to 2008, estimating a production bug can cost about six times more than one caught during implementation.
- Explains how unit tests support safe mechanical refactoring and raise confidence in small changes.
- Contrasts the developer inner loop (code, build, run) with slower outer-loop tests run at PR or merge time.
- Argues that tests double as executable usage documentation that stays current because it runs on every build.
How to use it
PrepKit study advice, not a claim made by the source.
Turn the four sections into a spoken answer to "why write unit tests?" and attach a real example from your own code to at least one point, such as a refactor a test protected. Check that the answer stays under two minutes.
Scope and limitations
Persuasive overview only; it does not teach how to write tests, and the IBM figure is quoted from a 2008 source that PrepKit has not checked. The inner-loop section mentions Visual Studio Live Unit Testing, a Microsoft tool.
Access and format
Free English web page in the ISE Engineering Fundamentals Playbook on microsoft.github.io; the text comes from the CC BY 4.0 microsoft/code-with-engineering-playbook repository.
Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 016770e43d8a
Evidence behind this overview
- docs/automated-testing/unit-testing/why-unit-tests.md
Pages that include this
Get the PrepKit newsletter
Optional. You don't need it to use PrepKit.