9
Unit Testing
Until now, we’ve been focusing on creating the app, but there is danger in going too far without introducing unit testing. In this chapter, we will focus on writing comprehensive and meaningful unit tests using best practices.
Test-driven development (TDD)
Some developers believe that unit tests should come before the code (TDD), but that is beyond the scope of this book.
Unit testing is crucial to creating robust applications and knowing that your app works before you ship it. It is also a critical aspect of debugging, telling you right away if something you just changed or added broke some aspect of your app.
To facilitate unit tests, you’ll want to use dependency injection so that you can mock up time-consuming services, such ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access