Chapter 9. Testing All the Things
In this chapter, we’re going to explore the various testing options available to you as a Blazor developer. It’s important to know what you can test, and how to test it. We’ll start with the most basic testing use cases that apply to all .NET and JavaScript developers alike. I’ll provide an introduction to testing and show you how to use the xUnit, bUnit, and Playwright testing frameworks. We will then move on to more advanced testing scenarios. We’ll finish with code examples that exemplify how to automate testing with GitHub Action workflows, and how to write tests, such as unit tests, component tests, and end-to-end tests.
Why Test?
You may be asking, “What’s the point of testing if your code works anyway?” That’s a fair question. For years, I felt the same way — I disliked testing because it seemed unnecessary. After years of writing code, however, I’ve changed my mind. Testing is a great way to ensure that your code works as expected and can be refactored ...
Get Learning Blazor 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.