Testing React Applications Like an Engineer

This ad is not shown to multipass and full ticket holders
React Summit US
React Summit US 2025
November 17 - 21, 2025
New York, US & Online
The biggest React conference in the US
Learn More
In partnership with Focus Reactive
Upcoming event
React Summit US 2025
React Summit US 2025
November 17 - 21, 2025. New York, US & Online
Learn more
Bookmark
Rate this content

As our React applications grow, so do the challenges of maintaining bug-free code. Crafting a reliable test suite can be a daunting task, often plagued by flakiness and complexity. In this talk, I’ll break down a practical, engineering-first approach to writing tests that actually make development smoother. We’ll dive into the best ways to integrate Playwright with React, ditch outdated testing mindsets, and adopt strategies that ensure your app works as expected—without the headaches. Expect real-world examples, actionable takeaways, and a fresh perspective on testing that might just make you enjoy it.

This talk has been presented at React Summit 2025, check out the latest edition of this React Conference.

FAQ

Austin Shelby emphasizes the importance of testing as a proactive rather than an afterthought approach. He advocates for testing to be focused on user flows and documenting application functionality clearly and comprehensively.

NASA thoroughly tests every function and line of code of the rover by replicating Mars-like conditions on Earth, including similar soil, extreme temperatures, sounds, and winds.

Austin Shelby believes that in the age of Next.js, the traditional testing pyramid is less relevant. He suggests focusing on user-centric testing rather than strictly adhering to unit, integration, and end-to-end test ratios.

The 'arrange, act, assert' pattern is a structure for writing clear and effective tests. It involves setting up the test conditions (arrange), performing the test actions (act), and verifying the results (assert).

He provides an example of registering a new user in a notes app, demonstrating how to write a simple test using Playwright that verifies successful registration and redirection to the homepage.

User stories help create clear and relatable test cases that communicate the intent of the application’s functionality in a language understandable by both technical and product teams.

Tests serve as documentation by clearly outlining the expected behaviors and functions of the application. If functionality changes, failing tests highlight where issues occur.

Behavior-Driven Development (BDD) encourages using a shared language for writing test scenarios, enabling better communication between technical and product individuals about application functions.

Austin Shelby supports TDD as a tool for solving complex problems. He recommends reproducing bugs locally, fixing them, and using tests as safeguards for confident deployment.

Austin Shelby finds some BDD tools like Cucumber to be gimmicky and suggests focusing on the specificity and clarity of test scenarios instead.

Austin Shelby
Austin Shelby
19 min
17 Jun, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Imagine the scenario of working on the Mars rover, emphasizing the importance of thorough testing. Learn to test React applications effectively like an engineer. Focus on user-centric testing over traditional paradigms. Write precise test cases as user stories using BDD for clear communication. Utilize a structured approach with arrange, act, assert steps for clear tests. TDD is valuable for bug diagnosis and solutions, emphasizing efficient bug reproduction and resolution. Annotate tests to reproduce and fix bugs, focusing on user flows and effective bug fixing.

1. Testing React Applications like an Engineer

Short description:

Imagine the scenario of working on the Mars rover, emphasizing the importance of thorough testing. Learn to test React applications effectively like an engineer. Focus on common testing issues and the role of React components in software development.

Imagine the following scenario. You are an engineer working at NASA, and for the past few years you have worked on the perseverance Mars rover. And finally it's time. It's on the way to Mars and everything is going well. It lands successfully, but then there's an unexpected error. What can you do? You can't just fly to Mars and fix it, well, because it's one of the most expensive Well, because it's 140 million miles away. So what do you do? Exactly for these cases, every single function and every single line of code in the rover had to be thoroughly tested. And NASA engineers are one of the best testers in the world. They replicated the scenarios that can happen in Mars in earth. They created a little playground with similar soil that is in Mars and exposed the rover to extreme temperature, sounds and winds. And we can use these same techniques when we are testing our software.

And that is what I want to help you do today. I want to help you to test React applications like an engineer. My name is Austin Shelby, and I'm a freelance software engineer from Finland. Some of you may know me from my YouTube videos where I teach programming. I'm also the founder of MandoFlow, the best way to learn Mandarin Chinese online by turning your favorite YouTube videos into personalized language learning lessons. So when I talk about testing, I want to focus on four main issues that most developers have, starting with that testing is seen as an afterthought.

Now, if you have learned anything about testing, you have surely come across a picture that looks something like this, the famous test pyramid. It shows the optimal ratio of end to end integration and unit tests that you should have in your application. Or maybe you have seen an image like this. Or maybe this one. Now, it seems like everyone has their own opinion of the perfect ratio. But I think in the age of Next.js, it doesn't matter that much because most of the code that we write nowadays looks something like this. Now, React components in its simplest form are just a function of your state. But let's take a look at this single unit, a single React component. Here we are getting the authenticated user, which checks the request cookie and fetches the session based on it. If there is a user, it will redirect it into the profile. This redirect function throws a special Next.js error. And we're also rendering the register form. So this single unit is doing quite a lot of things.

2. User-Centric Testing with Playwright

Short description:

Focus on user-centric testing over traditional paradigms. Explore testing scenarios with a demo app using Playwright. Write simple tests for user registration and data integrity in the application.

So should we write a unit test to it? I don't think it matters. And honestly, I would forget about the unit integration and end to end paradigm. And rather focus on the user because most applications have one of two goals. Either to get the user to sign up or make them do a purchase.

Now, let me show you the demo application that I created for this talk. We can use this to explore different scenarios and how to test them with Playwright. So in the notes app, I can create a new user. Let's just call it Austin. And add some password. Once we register, it redirects us to the home page and gives us a nice welcome message. We can also create some notes. Like A, B, and C. And we can see that they're being ordered by their creation time.

Now, let's use the registration as an example on how to write a simple test with Playwright. We're going to import test and expect from Playwright, and then we're going to write the test first. We're going to go to the register page. Then we're going to select the username input by the label username and password. Then we're going to fill in the data. Test user and password 123. And then we're going to press enter. Then we're going to perform two assertions. First, that the page should be on the home page and that we have the welcome message. Welcome test user. But there's one more thing missing. These tests are touching the database and we want each test to be started from a clean slate.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Testing Web Applications with Playwright
TestJS Summit 2022TestJS Summit 2022
20 min
Testing Web Applications with Playwright
Top Content
Watch video: Testing Web Applications with Playwright
Testing web applications with Playwright, a reliable end-to-end testing tool. Playwright offers fast execution, powerful tooling, and support for multiple languages. It provides precise selectors, web-first assertions, and code generation for easy testing. Playwright also offers features like live debugging, tracing, and running tests on CI. The future of Playwright aims to make testing easy and fun, with a focus on creating frustration-free web experiences.
Full-Circle Testing With Cypress
TestJS Summit 2022TestJS Summit 2022
27 min
Full-Circle Testing With Cypress
Top Content
Cypress is a powerful tool for end-to-end testing and API testing. It provides instant feedback on test errors and allows tests to be run inside the browser. Cypress enables testing at both the application and network layers, making it easier to reach different edge cases. With features like AppActions and component testing, Cypress allows for comprehensive testing of individual components and the entire application. Join the workshops to learn more about full circle testing with Cypress.
Everyone Can Easily Write Tests
TestJS Summit 2023TestJS Summit 2023
21 min
Everyone Can Easily Write Tests
Playwright is a reliable end-to-end testing tool for modern web apps that provides one API, full isolation, fast execution, and supports multiple languages. It offers features like auto-weighting, retrying assertions, seamless testing of iframes and shadow DOM, test isolation, parallelism, and scalability. Playwright provides tools like VS Code extension, UiMode, and Trace Viewer for writing, debugging, and running tests. Effective tests prioritize user-facing attributes, use playwright locators and assertions, and avoid testing third-party dependencies. Playwright simplifies testing by generating tests, providing code generation and UI mode, and allows for easy running and debugging of tests. It helps in fixing failed tests and analyzing DOM changes, fixing locator mismatches, and scaling tests. Playwright is open source, free, and continuously growing.
Tiny Tests, Large Results
TestJS Summit 2022TestJS Summit 2022
21 min
Tiny Tests, Large Results
Automated atomic tests are a great way to improve UI tests by making them less brittle and faster. The tests focus on testing a single feature or component and have minimal UI interactions. The Talk explores examples of automated atomic tests and their implementation on web applications. It also discusses the analysis of atomic tests, login tests, and working with JSON Web Tokens for authentication and authorization. The Talk concludes by highlighting the use of UI and web requests in automated atomic testing.
We May Not Need Component Testing
Vue.js Live 2024Vue.js Live 2024
26 min
We May Not Need Component Testing
Component testing is a gray area between integration and unit testing. The demo app focuses on the cart component and writing test cases for Playwright component test and VTest. The first cart test encounters a bug with the invisible method in View Test.
Testing Mail Service With Playwright
TestJS Summit 2022TestJS Summit 2022
17 min
Testing Mail Service With Playwright
Top Content
Watch video: Testing Mail Service With Playwright
This Talk discusses how to test mail service with Playwright, covering e-mail verification, reset password user journey, and more. It explores the use of third-party providers for reliable e-mail delivery and demonstrates how Playwright can help perform checks on e-mail content. The Talk also introduces the concept of a fake SMTP server and showcases how fixtures can be used to access the SMTP server and perform assertions on the HTML body of emails. Playwright's HTML rendering feature allows for interaction with email content as if it were a regular web page. It highlights the ability to render HTML from API calls, perform assertions on the rendered page, and exclude dynamically generated data from visual regression tests.

Workshops on related topic

Detox 101: How to write stable end-to-end tests for your React Native application
React Summit 2022React Summit 2022
117 min
Detox 101: How to write stable end-to-end tests for your React Native application
Top Content
Workshop
Yevheniia Hlovatska
Yevheniia Hlovatska
Compared to unit testing, end-to-end testing aims to interact with your application just like a real user. And as we all know it can be pretty challenging. Especially when we talk about Mobile applications.
Tests rely on many conditions and are considered to be slow and flaky. On the other hand - end-to-end tests can give the greatest confidence that your app is working. And if done right - can become an amazing tool for boosting developer velocity.
Detox is a gray-box end-to-end testing framework for mobile apps. Developed by Wix to solve the problem of slowness and flakiness and used by React Native itself as its E2E testing tool.
Join me on this workshop to learn how to make your mobile end-to-end tests with Detox rock.
Prerequisites- iOS/Android: MacOS Catalina or newer- Android only: Linux- Install before the workshop
Testing Web Applications Using Cypress
TestJS Summit - January, 2021TestJS Summit - January, 2021
173 min
Testing Web Applications Using Cypress
Top Content
Workshop
Gleb Bahmutov
Gleb Bahmutov
This workshop will teach you the basics of writing useful end-to-end tests using Cypress Test Runner.
We will cover writing tests, covering every application feature, structuring tests, intercepting network requests, and setting up the backend data.
Anyone who knows JavaScript programming language and has NPM installed would be able to follow along.
Building out a meaningful test suite that's not all E2E
TestJS Summit 2023TestJS Summit 2023
89 min
Building out a meaningful test suite that's not all E2E
Workshop
David Burns
David Burns
We're all taught to follow the Testing Pyramid but the reality is that we build out the Testing Christmas Tree. In this workshop, David will talk you through how to break down projects and put the tests where they need to be. By the end of the workshop you will be able to update your projects so that anyone and everyone can start contributing and truly living up to "Quality is everyone job".
He will walk you through:- Component Testing- API Testing- Visual Regression Testing- A11Y testing
He will also talk you through how to get these all setup in your CI/CD pipeline so that you can get shorter and faster feedback loops.
Live e2e test debugging for a distributed serverless application
TestJS Summit 2021TestJS Summit 2021
146 min
Live e2e test debugging for a distributed serverless application
Workshop
Serkan Ozal
Oguzhan Ozdemir
2 authors
In this workshop, we will be building a testing environment for a pre-built application, then we will write and automate end-to-end tests for our serverless application. And in the final step, we will demonstrate how easy it is to understand the root cause of an erroneous test using distributed testing and how to debug it in our CI/CD pipeline with Thundra Foresight.

Table of contents:
- How to set up and test your cloud infrastructure
- How to write and automate end-to-end tests for your serverless workloads
- How to debug, trace, and troubleshot test failures with Thundra Foresight in your CI/CD pipelines
Uniform Browser Automation Infrastructure
TestJS Summit - January, 2021TestJS Summit - January, 2021
127 min
Uniform Browser Automation Infrastructure
Workshop
Ivan Krutov
Ivan Krutov
In this workshop, I will show you how to quickly deploy and use browser automation infrastructure with Moon solution. We will start deploying everything on your workstation and will soon be able to run Selenium, Playwright and Puppeteer tests in parallel in the same cluster. Then I will demonstrate how to easily deliver the same experience for your team using a remote cluster in the cloud platform.