Performance Testing Tutorial Part 2: Front End Testing Using and Docker

Typically, we hear a lot about performance testing, REST API testing, and even JMeter. But in this post, I am going to explain how to create a robust and modern framework for front end testing, since most of the tools on the market actually only help test our backend.

Additionally, we will take a look at how browsers work behind the scenes rendering resources (an infinite number of JavaScript layers or DOM manipulations) and how we can monitor them to identify regressions.

The framework we are going to implement for front end testing consists of the following tools: + Docker + InfluxDB + Grafana + Selenium (and it’s really important to mention that ALL of these tools are free!). is an emerging tool that makes it easy to monitor and measure the performance of any website. Additionally, it also has full integration with the Docker engine.

Let’s take the bull by the horns and list all the steps to create a full front end, client-side performance suite: 

Step 1: Install the Docker image. First of all, you need to make sure you have Docker installed on your machine. If so, open your terminal and type:

• docker run –rm -v “$(pwd)”:/ sitespeedio/

• After image creation, type “docker image ls” to make sure the image got installed successfully.

Note: It is crucial to keep your instance updated. For more info about pulling, check out the documentation.

Step 2: Pull the InfluxDB & Grafana Docker containers. InfluxDB is a time series database that we are going to use to store our metrics. We will use Grafana to monitor them in real time. To acquire these tools, open your terminal and type the following commands:

• docker pull influxdb

• docker pull grafana/grafana

These commands will pull InfluxDB and Grafana from Docker Hub. After that, type “docker ps” in your terminal to make sure the containers were installed successfully.


 type “docker ps” in your terminal


Step 3: Create a Docker network to connect containers. The next step in this front end testing tutorial is to get the InfluxDB and Grafana containers to talk to each other. The way we are going to do this is by implementing a Docker network. Open your terminal and type the following commands:

• docker ps (extract Container ID for InfluxDB)in my case, “0261ec478a21”

• docker network create my-net

• docker network connect my-net 0261ec478a21

• docker network ls (list all networks) front end testing 

Step 4: Create a database in InfluxDB. We need to have a place to store our metrics. It is similar to native SQL, but first you need to get inside the InfluxDB container by using the following command:

• docker exec -it <INFLUXDB-CONTAINER-ID> influx (with this command, you will be able to access the InfluxDB shell to send SQL commands)

• CREATE DATABASE fe_performance


Database in InfluxDB for front end testing

Note: The _internal database is created and used by InfluxDB to store internal runtime metrics. Check it out later to get an interesting look at how InfluxDB is performing under the hood.

Step 5: Set up the InfluxDB data source in Grafana. Open http://localhost:3000/?orgId=1 in your browser. There, you should be able to see the Grafana interface.

• From Grafana, click the gear configuration icon > “Data Sources.”

• Click the “Add Data Source” button > “Choose Data Source.” Type in “InfluxDB.”

• Add the following details to the new data source:

 InfluxDB data source in Grafana

• Set up a password of your choice, then click on the “Save & Test” button. If everything has been set up correctly, you should see a green pop-up saying the “Data Source is working.”  

Step 6: Create the Grafana dashboard. In order to display the metrics, we need to create the site speed dashboard. For this specific task, we are going to import a JSON script by following these steps:

• Click the “+” icon on the left menu > “Import.”

• In the text box, paste the JSON script copied from this link.  

• Click the “Load” button.

• In the import options, set a name for your dashboard, the folder where you want to have it, and the InfluxDB data source created in step 5.

• Click the “Import” button.

Grafana dashboard

BRAVO! You can now see the Grafana dashboard integrated with and InfluxDB.

Step 7: Write a custom Selenium async script. If the application being tested needs to perform a log-in block, or you need to follow a sequence of processes, the best way is to implement a Selenium script for that executes multiple flows.

In the following example, I am using the EventCloud demo page, and the script name is “EventCloud2.js”:

These lines of code execute three use cases: “load the EventCloud page,” “open the register page,” and “perform a log-in.”

Note: You can find more information on the scripting page.

Step 8: Run the command. One of the last steps in this front end testing tutorial is to run the command in order to store data in InfluxDB and display it on Grafana. The command we will use is the following:

• docker run –rm -v “$(pwd)”:/ sitespeedio/ –network=my-net – <LOCALHOST-IP> –influxdb.port 8086 –influxdb.database fe_performance EventCloud2.js –multi –browsertime.visualMetrics false – false –browsertime.skipHar –plugins.remove html

For more information about the flags used in the above command, check out the documentation.

It is important to note that you can run the command either using your terminal or Jenkins. You can have more flexibility, automation views, and periodic builds if you use Jenkins for your front end testing.  

Some results:

Front end testing results

Due to the variety of JavaScript flavors we have these days, we need to be defensive in regard to the time that every web component takes to render in our front end. Our users expect speed when navigating, so we need to offer it from the first click.

Go ahead and check it out; your users will appreciate the silent improvements you make to your website with the tools from this front end testing tutorial!  



Subscribe to our Blog

Andrey Rojas
Andrey Rojas
Andrey is a Performance Test Engineer with 4 years of experience in testing. In his free time he enjoys studying new technologies and spending time with his daughter.

Deliver off-the-chart results.

WordPress Video Lightbox Plugin