in

How to Perform Load Testing With Real Browsers Using Flood Element

Hey there!

As someone involved in web development, you know how important performance testing is. But I bet you‘ve also experienced frustration with traditional protocol-level load testing tools. They can miss real front-end bottlenecks and be tedious to maintain.

I want to tell you about an exciting new approach called browser-level load testing. It provides a more accurate and holistic view of real user experience.

In this guide, we’ll explore:

  • Shortcomings of legacy load testing methods
  • How browser-level testing works
  • Steps to run browser tests locally and at scale
  • Tips to get useful results
  • Key benefits over protocol-level tools

Let’s get started!

Why Existing Load Testing Approaches Fall Short

Legacy load testing tools work by simulating users as series of raw HTTP/HTTPS requests. The problem? Real users don‘t experience your app as network calls – they interact with a live web page.

Protocol-level tools can only assess the back-end performance of your infrastructure. They lack visibility into front-end code execution and browser rendering that impacts real UX.

This is a big blindspot, considering research shows:

  • The average web page makes 115 requests to load and render fully. (source: HTTP Archive)

  • 80% of page load time occurs in the front-end, only 20% is the backend network. (source: AddyOsmani.com)

  • 53% of mobile site visitors will leave a page that takes over 3 seconds to load. (source: Google)

So protocol-level load tests miss the majority of issues that frustration users!

They also require tedious script maintenance as the UI changes:

"Click button #1, enter text A, click button #2, enter text B…"

This disconnects testing from the real front-end code.

Introducing Browser-Level Load Testing

To truly simulate how end users experience your site, we need to conduct tests using real browsers, not network stubs.

Browser-level load testing exercises the full front-end stack under load:

Browser level testing diagram

With this approach, you script tests using actual UI elements like clicks, keystrokes and form inputs.

For example:

// Visit homepage
await browser.visit("https://www.myshop.com"); 

// Click on product
await page.click(".product-link");

// Add item to cart
await page.click("#add-to-cart-button"); 

The scripts interact with elements on a live page, running real front-end code.

This provides a holistic view of performance, from database to browser. It‘s how end users really experience your app!

Flood Element enables running massively scalable browser-level tests in the cloud. Let‘s walk through how it works…

Step 1: Install Flood Element CLI

Flood Element is comprised of two components:

💻 Element CLI – Used to run tests locally
☁️ Flood – Cloud platform for large scale testing

You can install the Element CLI via NPM:

npm install -g @flood/element-cli

On macOS, Homebrew is also available:

brew install flood-element

The CLI contains everything needed to create, run and validate tests on your local machine.

Step 2: Create Your First Test Locally

With Element installed, you can scaffold a new test:

element new my-first-test

This generates a test script along with config files.

Element scripts use TypeScript, a popular strongly-typed version of JavaScript. Here‘s a simple example:

import { step, Browser } from ‘@flood/element‘;

@step("Visit homepage")
async homepage(browser: Browser) {
  await browser.visit("https://www.myshop.com");
}

@step("Add item to cart")  
async addToCart(browser: Browser) {
  await browser.click(".product-link");
  await browser.click("#add-to-cart-button");
}

The step decorator defines each user action. The browser object allows interacting with page elements.

This script loads the homepage, clicks a product, and adds it to the cart – just like a real user!

Step 3: Run Your Script Locally First

Before unleashing large load, always test locally first.

Use the element run command:

element run my-script.ts 

This will launch Chromium and execute your test steps.

Debug any issues with timeouts or errors. Get the script running smoothly before moving to the cloud.

Local testing allows rapid iteration as you expand your scripts.

Step 4: Scale Up Your Load Test on Flood

Once your script is solid, it‘s time to simulate production loads.

Flood allows running thousands of parallel browser-based users globally from the cloud.

  1. Sign up for a free trial of Flood

  2. Create a new Flood project

  3. Select the Browser (Element) option

  4. Upload your script and configure browsers and regions:

Flood test configuration

  1. Flood will spin up browser instances across regions and generate load.

As your test runs, you‘ll see live metrics on response times, requests per second, and errors. Flood makes it easy to inspect failures and identify bottlenecks.

Step 5: Analyze Results

Flood Element provides insightful load test analytics:

Requests per second graph

You can view total load over time, breakdowns by region, waterfall charts of page elements, and more.

Compare Flood metrics like page load times with business KPIs like bounce rates and conversions. This helps quantify how performance impacts revenue.

Tips for Running Effective Browser-Based Load Tests

Here are some tips to ensure your Flood Element tests provide maximum value:

  • Scale gradually – Start small and increase load in increments to discover capacity limits.

  • Isolate 3rd parties – Stub analytics calls to avoid false load.

  • Mask real data – Generate fake inputs when submitting forms.

  • Correlate with metrics – Compare load metrics with business KPIs to quantify impact.

  • Re-run often – Execute tests frequently as part of CI/CD to catch regressions.

  • Review on real devices – Validate performance on mobile devices.

  • Extend scripts – Expand test coverage to additional user journeys over time.

Why Browser-Level Testing Beats Protocol-Level Tools

Let‘s recap the key benefits of browser-level load testing:

Accurate Simulation

Testing via real browsers provides the most realistic model of end user experience.

Full Visibility

Browser tests exercise the full application stack, front and backend.

Natural Scripting

Scripting real user workflows is straightforward for devs.

Painless Debugging

When errors occur, browser scripts are easy to debug live.

Up-to-Date Coverage

Changes to frontend code are automatically reflected. No rewrite needed.

User-Centric Insights

Page timings, clicks, and form inputs metrics map to real UX.

Mobile Friendly

Mobile and desktop experiences can be tested for responsive design.

Built for Scale

Cloud-based Fleet testing allows enormous, global browser load.

Get Started with Browser-Level Load Testing

Hopefully you now see why browser-level load testing is critical for providing the most accurate simulation of real user experience.

Flood Element makes implementing these modern testing practices fast and frictionless.

To get started:

  1. Install the CLI and write basic scripts
  2. Validate locally before scaling up
  3. Run massively scalable tests using Flood
  4. Analyze results and expand coverage over time

Sign up now for a free trial of Flood to experience the benefits first-hand!

Let me know if you have any other questions!

AlexisKestler

Written by Alexis Kestler

A female web designer and programmer - Now is a 36-year IT professional with over 15 years of experience living in NorCal. I enjoy keeping my feet wet in the world of technology through reading, working, and researching topics that pique my interest.