Chapter 21. Frontend Testing
In previous chapters, I mentioned that the best practice for writing any tests is to write them at the same time as you write any new functionality or do any refactors. Testing deserves its own focus, and that’s what I’ll cover here.
When you’re building this app, you need to make sure you aren’t releasing regressions in existing functionality. A regression is when new code unintentionally causes errors in existing functionality anywhere in the app. The QA team, if there is one, won’t have time to run regression testing on every single release, but as a developer, you can take the initiative to ensure your code is solid. Your tests for the new code can bring up questions about how something works or what happens when it doesn’t.
In this chapter, I’ll cover:
-
How to determine which parts of the frontend to test
-
Unit testing
-
End-to-end (e2e) testing
-
Useful testing tools
The two goals of test writing are preventing unexpected broken code from ending up in front of users and documenting the app so that everyone knows how it’s supposed to work. Testing also gives you more confidence with future development because you aren’t worried about your changes breaking something unexpectedly.
Testing will bring your dev team, the Product team, the Design team, and the QA team even closer together as you all come up with different scenarios. Always remember that QA is not the enemy. Their job is crucial to deploying with confidence. They aren’t telling you ...
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