Measure and Improve Frontend Performance by Using Test Automation

Rate this content
Bookmark

Automated performance testing can help detect the harmful effects of code changes on application performance. Learn how to use tools like Lighthouse and Web Core Vitals in your CI and set performance thresholds to maintain optimal frontend performance in this session.

This talk has been presented at TestJS Summit 2023, check out the latest edition of this JavaScript Conference.

FAQ

Ramona uses the quote 'Content is King' to emphasize the importance of content in digital contexts. She adapts it to 'Information is King', highlighting the crucial role of information in understanding and improving application performance.

Ramona suggests using existing test automation tools to monitor application performance, highlighting the efficiency of leveraging automated tests to assess performance metrics without the need for additional specialized tools.

The three main principles discussed by Ramona are: making an application work (functionality), making it right (maintainability and clean code), and making it fast (performance and user satisfaction).

Ramona mentions using Lighthouse and a Cypress plugin called Cypress Audit for monitoring front-end performance, which can help in analyzing performance issues and improving user experience.

Core Web Vitals, as discussed by Ramona, are a set of specific performance metrics from Google that measure user experience on websites, focusing on loading speed, interactivity, and visual stability.

Ramona suggests that 'misusing' test automation refers to leveraging existing testing frameworks and tools, typically used for functional testing, to also monitor and evaluate performance metrics, thus extending their utility beyond their original purpose.

Logging is crucial in test automation as it helps record events and errors within the tests. This information is vital for diagnosing issues, understanding application behavior, and improving test outcomes.

Ramona's primary focus at the TestJS Summit is on the importance of performance testing and how test automation can be utilized to monitor and improve application performance.

Ramona is a Developer Advocate at Offs Zero, a Google Developer Expert in web technology, and a Cypress Ambassador.

Ramona Schwering
Ramona Schwering
22 min
11 Dec, 2023

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The Talk focuses on the importance of testing and gathering information for building good applications. It highlights the use of test automation for performance monitoring and logging for performance measurement. The Talk also discusses the impact of performance on user engagement and search engine rankings. It emphasizes the use of Cypress plugins for monitoring performance metrics and setting thresholds for tests. Overall, the Talk emphasizes the value of test automation tools in providing valuable information at a low cost.

1. Introduction to Testing and Information

Short description:

Hello, everyone at TestJS Summit this time. I'm so glad to be here again. Today, I'm coming home with an interesting discovery on performance. I'm passionate about testing and believe that information is king. Gathering information is important for building good applications. Make it work, make it right, make it fast - the order of building good applications.

Hello, everyone at TestJS Summit this time. I'm so glad to be here again because the TestJS summit was one of the first conferences I was honored to be a speaker at. It's just like coming home today.

Today, I'm actually coming home here with a little interesting discovery I want to showcase to you when it gets to my testing experience. If you might have guessed already, it's on performance. Well, before that, real quick, my name is Ramona. I'm working as a Developer Advocate at Offs Zero. Apart from that, I'm a Google Developer Expert in web technology and a Cypress Ambassador. As you might have guessed, I think I'm, yeah, at least I'm passionate when it comes to testing. Yeah, it shouldn't be a surprise that I'm here to talk about testing today.

So well, especially when it comes to testing, there are some things which are really important. And yeah, this little thing, Content is King, which I hope I have enough for this 20 minutes. It was done by Steve Bommer, I guess. He's doing lots of quotes, which are memorable. But well, let's change this quote a little bit. Because, if Content is King, Information is King like, doubled or even more. And it's not just because I like to play video games and this is the title of a World of Warcraft quest. But I, well, find interesting. At least I like those little sidequests where, for example in this case, a goblin vendor named Goodskitch wants to have some Krukal skin in exchange for information. So, it's not only in video games that information is really important. Gathering information, having a good grasp on what happens inside of your application, is really important. Not only in gaming, but also when it comes to testing.

So, well, I guess this should be clear for most of the time. But, well, why do we need to have information on our application? Because we want to build good applications, right? So, you might have stumbled upon this quote by Comeback, which says, make it work, make it right, make it fast, in that particular order. So, just to dive into it a little bit, make it work is self-explanatory. So try to solve a problem at hand, which might build a good application. So, well, just make it work when it comes to your requirements. If you are able to do that, do the second thing, make it maintainable, make it right. So, try to mind non-functional requirements. Mind clean code, for example, to make it not only work, but work the right way and work the way that you still want to work with your application, let's say, one year from now.

2. Using Test Automation for Performance Monitoring

Short description:

And last but not least, make it perform, make it fast, make it that the user is not annoyed by using your application. We can use automation to support us in all of those three points, even performance. Test automation can be used for monitoring performance and gathering information. Logging is the art of keeping a log or a list of events that occur in your computer system, such as problems, errors, or just information in the current operations.

And last but not least, make it perform, make it fast, make it that the user is not annoyed by using your application. And yes, of course, the first point, make it work is pretty easily achieved with testing. So, if you test your application, you know that it's working as intended. The second one, make it right can be supported by tooling, for example, if we had good tests, making it easier to write good code. And I don't want to start with all the linches, all the static analysis tools you can run, like phpStan, ESlearnStyle and whatever. But, well, we have good support when it comes to first, like, make it work, make it right. But what is with the third point, make it fast and perform and basically make it feel flawless? Well, make your application perform seems really daunting, because as I said, you don't have that much tool support yet. And well, even the point, the steps of speeding up your application code wise is really difficult, because you could ask, like, who has time for that, who has the power to do that? And may it be because of pressure by clients, but especially head space inside of yourself. And do we get the time for improving the performance or maintaining it? Because even getting all the information you need on your application to monitor performance, doing all those measures locally takes lots of time. And all of this together seems really daunting. So what if I told you some interesting point that we don't need to feel lost. We don't need to feel so drained or scared. What if I told you that we can use automation to support us in all of those three points? Even performance. Not only working, not only making it right, making it perform. What if I told you you can use test automation for that? Not only trying to learn GitHub Actions to implement some tools to help us to monitor performance, but using everything we already have. Test automation we already have for our project. Well, I know, I know, it's a little like misusing testing, right? So well, it's still good because you can use your knowledge you already have for it. You don't need to learn new tools. You can use your well known familiar CI. For example, if you don't want to use GitHub Actions, which can give it to you, or if a standardized GitHub Action is not enough to fulfill your needs. So, in my mind I think it's interesting to use end to end testing for measuring performance because the AppStack application stack is completely there, and existent. So we can do more of it, than only when it comes to unit tests. And we are close to the user who would be annoyed by performance problems, right? But, if we want to think about using test automation for monitoring performance and gathering, monitoring, and collecting information on our performance, let's take a step back and take a look how we measure or collect information on our test automation to begin with. Well, as this talk is called Measuring, let's start with the defaults to shed some light on it.

Many think about the most interesting or most normal way of taking a look at information from your test automation pipelines. For example, if you want to take a look why something fails, you will take a look at the logs. Logging is actually the art of keeping a log or a list of events that occur in your computer system, such as problems, errors, or just information in the current operations. It might be testing, for example, in this regard. It logs everything what happens inside of your tests. It looks like that.

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

A Guide to React Rendering Behavior
React Advanced 2022React Advanced 2022
25 min
A Guide to React Rendering Behavior
Top Content
This transcription provides a brief guide to React rendering behavior. It explains the process of rendering, comparing new and old elements, and the importance of pure rendering without side effects. It also covers topics such as batching and double rendering, optimizing rendering and using context and Redux in React. Overall, it offers valuable insights for developers looking to understand and optimize React rendering.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
Network Requests with Cypress
TestJS Summit 2021TestJS Summit 2021
33 min
Network Requests with Cypress
Top Content
Cecilia Martinez, a technical account manager at Cypress, discusses network requests in Cypress and demonstrates commands like cydot request and SCI.INTERCEPT. She also explains dynamic matching and aliasing, network stubbing, and the pros and cons of using real server responses versus stubbing. The talk covers logging request responses, testing front-end and backend API, handling list length and DOM traversal, lazy loading, and provides resources for beginners to learn Cypress.
React Concurrency, Explained
React Summit 2023React Summit 2023
23 min
React Concurrency, Explained
Top Content
Watch video: React Concurrency, Explained
React 18's concurrent rendering, specifically the useTransition hook, optimizes app performance by allowing non-urgent updates to be processed without freezing the UI. However, there are drawbacks such as longer processing time for non-urgent updates and increased CPU usage. The useTransition hook works similarly to throttling or bouncing, making it useful for addressing performance issues caused by multiple small components. Libraries like React Query may require the use of alternative APIs to handle urgent and non-urgent updates effectively.
Testing Pyramid Makes Little Sense, What We Can Use Instead
TestJS Summit 2021TestJS Summit 2021
38 min
Testing Pyramid Makes Little Sense, What We Can Use Instead
Top Content
Featured Video
Gleb Bahmutov
Roman Sandler
2 authors
The testing pyramid - the canonical shape of tests that defined what types of tests we need to write to make sure the app works - is ... obsolete. In this presentation, Roman Sandler and Gleb Bahmutov argue what the testing shape works better for today's web applications.
The Future of Performance Tooling
JSNation 2022JSNation 2022
21 min
The Future of Performance Tooling
Top Content
Today's Talk discusses the future of performance tooling, focusing on user-centric, actionable, and contextual approaches. The introduction highlights Adi Osmani's expertise in performance tools and his passion for DevTools features. The Talk explores the integration of user flows into DevTools and Lighthouse, enabling performance measurement and optimization. It also showcases the import/export feature for user flows and the collaboration potential with Lighthouse. The Talk further delves into the use of flows with other tools like web page test and Cypress, offering cross-browser testing capabilities. The actionable aspect emphasizes the importance of metrics like Interaction to Next Paint and Total Blocking Time, as well as the improvements in Lighthouse and performance debugging tools. Lastly, the Talk emphasizes the iterative nature of performance improvement and the user-centric, actionable, and contextual future of performance tooling.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Designing Effective Tests With React Testing Library
React Summit 2023React Summit 2023
151 min
Designing Effective Tests With React Testing Library
Top Content
Featured Workshop
Josh Justice
Josh Justice
React Testing Library is a great framework for React component tests because there are a lot of questions it answers for you, so you don’t need to worry about those questions. But that doesn’t mean testing is easy. There are still a lot of questions you have to figure out for yourself: How many component tests should you write vs end-to-end tests or lower-level unit tests? How can you test a certain line of code that is tricky to test? And what in the world are you supposed to do about that persistent act() warning?
In this three-hour workshop we’ll introduce React Testing Library along with a mental model for how to think about designing your component tests. This mental model will help you see how to test each bit of logic, whether or not to mock dependencies, and will help improve the design of your components. You’ll walk away with the tools, techniques, and principles you need to implement low-cost, high-value component tests.
Table of contents- The different kinds of React application tests, and where component tests fit in- A mental model for thinking about the inputs and outputs of the components you test- Options for selecting DOM elements to verify and interact with them- The value of mocks and why they shouldn’t be avoided- The challenges with asynchrony in RTL tests and how to handle them
Prerequisites- Familiarity with building applications with React- Basic experience writing automated tests with Jest or another unit testing framework- You do not need any experience with React Testing Library- Machine setup: Node LTS, Yarn
Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
How to Start With Cypress
TestJS Summit 2022TestJS Summit 2022
146 min
How to Start With Cypress
Featured WorkshopFree
Filip Hric
Filip Hric
The web has evolved. Finally, testing has also. Cypress is a modern testing tool that answers the testing needs of modern web applications. It has been gaining a lot of traction in the last couple of years, gaining worldwide popularity. If you have been waiting to learn Cypress, wait no more! Filip Hric will guide you through the first steps on how to start using Cypress and set up a project on your own. The good news is, learning Cypress is incredibly easy. You'll write your first test in no time, and then you'll discover how to write a full end-to-end test for a modern web application. You'll learn the core concepts like retry-ability. Discover how to work and interact with your application and learn how to combine API and UI tests. Throughout this whole workshop, we will write code and do practical exercises. You will leave with a hands-on experience that you can translate to your own project.
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
WorkshopFree
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
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up