Unit Testing is the process of writing small, code-level tests that prove that the method did what the developer intended when the test was written. Well-written Unit Tests test only one specific aspect or path through a single method (from @TimOttinger see F.I.R.S.T. Unit Testing Principles). Since most methods have multiple paths through them, they need multiple tests.
Unit Testing is not a replacement for Exploratory Testing, nor does it put Testers out of work. Instead, a Unit Test is simply a tool to help a developer discover if they built what they intended to. If their intentions weren’t correct, a Unit Test won’t catch that so they have only a limited effect on quality. But a Unit Test is useful as a safety net by demonstrating whether a change in the code affects the test case. Running Unit Tests frequently (usually every 10 -15 minutes) will give quick feedback if changes have harmed the behaviour of some other part of the code.
Resource Links:
- Choosing the right JavaScript testing tool
- Code from Practical Unit Testing with JUnit and Mockito
- Database UnitTesting Framework for SQL Server
- Don’t Measure Unit Test Code Coverage
- F.I.R.S.T. Unit Testing Principles
- Improve Your Unit Testing 12 Ways
- Improving On assertEquals with JUnit and Hamcrest
- Infinitest
- JUnit’s Built-in Hamcrest Core Matcher Support
- Multiple Asserts Are OK
- Real world mutation testing
- Test Driven Databases
- UnitTest (by Martin Fowler)
- Unit Testing (from the book Software Engineering at Google)
Unit Testing Books:
- Practical Unit Testing with JUnit and Mockito – Tomek Kaczanowski
- Pragmatic Unit Testing in C# with NUnit – Andy Hunt, Dave Thomas
- Pragmatic Unit Testing in Java with JUnit – Andy Hunt, Dave Thomas
- xUnit Test Patterns: Refactoring Test Code – Gerard Meszaros
- The Art of Unit Testing: with Examples in .NET – Roy Osherove
Mark Levison has been helping Scrum teams and organizations with Agile, Scrum and Kanban style approaches since 2001. From certified scrum master training to custom Agile courses, he has helped well over 8,000 individuals, earning him respect and top rated reviews as one of the pioneers within the industry, as well as a raft of certifications from the ScrumAlliance. Mark has been a speaker at various Agile Conferences for more than 20 years, and is a published Scrum author with eBooks as well as articles on InfoQ.com, ScrumAlliance.org an AgileAlliance.org.
*Thank you for visiting the World's Largest Opinionated Agile Reference Library. This content is created and the links are curated through the lens of Agile Pain Relief Consulting's view of what is effective in the practice of Scrum and Agile. We don't accept submissions and emails to that effect are marked as spam. Book listings may use affiliate links that could result in a small commission received by us if you purchase, but they do not affect the price at all. From experience, this won't amount to anything more than a cup of coffee in a year.« Back to Glossary Index