3 Unit testing: delivering code that works
This chapter covers
- Why unit tests are important
- What parts of your codebase to test and what parts to ignore
- How to test your code using dependency injection, mocks, stubs, and more
- When to create the tests during the development workflow
Unit testing is one of those tasks that all junior developers are assigned, especially when they first join an existing project. It is expected that they get familiar with the source code as soon as possible. The problem, though, is that the purpose of unit testing is to provide security and certainty over the stability of your code so you know it’s bug-free after you change it. Unit testing is not intended to help you understand a codebase. Furthermore, a junior ...
Get Skills of a Successful Software Engineer now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.