Pensum: A tool for automated creation of load tests
Arjan van Hugten
Arjan van Hugten
 3 Minutes
 11 December 2020

Pensum: A tool for automated creation of load tests

A load test provides insight in the performance of your website. Unfortunately, creating a load test is time-consuming and trying to create a realistic load test based on the actual users does not guarantee a correct simulation of the reality. We decided to create a solution for generating more realistic load tests based on real historical data of the website. The result is our Pensum tool that uses Google Analytics data.

Load tests 

To make sure your website can handle the desired amount of users and the load that they put on your website a load test is required. The load test can be scripted to simulate multiple users on the websiteBy creating multiple different user scenarios you can make the load test more realistic. A scenario contains the pages that the user has visited. By creating multiple scenarios you can simulate the different users on your website. For creating the scenarios you need information such as: which pages users visit and the time between requests that the user is executing. 

Below you can see a schematic visualization of client's that are putting load on your webserver.  They browse on your website and send requests to your webserver.

Schematic load test


The users on your website have different visit paths on your websiteit is important that the way users visit the pages on your site is scripted correctly in your load test. This can be achieved by analyzing the historical data and identifying the pages these users visited. With the historical information you can make your scenarios to simulate the different users. 

Think times 

When a user visits the website he or she will most likely stay at some pages to fill in forms or read the page, at this point the user is not putting any load on the server. To recreate this behavior, we use think times in our load test. With these think times we recreate the actual browsing of the user, instead of just sending the requests one by one. The think times will have influence on the requests per second and are crucial for a realistic load test. 


At Aviva Solutions we use K6 to create and run our load tests. K6 is an open source load testing tool for writing load-tests using JavaScript. K6 uses so-called Virtual Users who simulate user behavior on your website. The code snippet below shows an example of a simple K6 load test which sends a request to our website.

import http from 'k6/http'; 
import check from 'k6'; 

export default function () { 
    let response = http.get(''); 
    check(response, { 
        'status is 200': (r) => r.status === 200, 

During the load test K6 saves the results, as K6 has built-in support for outputting result data directly to an InfluxDB database. Afterwards you can use Grafana to visualize these results and get insight in your website’s performance. 

Execution of load test with K6

Our solution 

We wanted to automate the process of creating load test scenarios for our commerce solution. Previously we did this by analyzing and making calculations on the Google Analytics data and afterwards scripting the load test our self.  This took a lot of time, and we weren’t sure that the scenarios we created our self were realistic enough. 

Generating the load test 

Pensum takes Google Analytics data, after retrieving the data it needs to cleaned to make sure that there are fewer inconsistencies in itWhen the data is cleaned the Pensum tool can start creating load test scenarios. The result is a JSON file with the scenarios, the occurrence of the scenarios and the think times per page. In the image below you can see an example of created scenario’s and their probabilities. 

Example load test scenarios

Executing the load test 

The generated scenarios they are executed against a test environmentwith the help of K6 and our created state machine.  This state machine chooses and executes the scenario by moving through the different 'states' of the load test scenario. The script requires the JSON file and number of virtual users as parameters. It will then be executed for each virtual user. The state machine chooses the scenario for each virtual user and executes the scenario. During the scenario the think times will be simulated for the pages that are being requested. 

The test results are visualized using a Grafana dashboard. With the dashboard you can check things like the response times. It is also useful to compare the results with other previous load tests to see if your performance is changed. 

Grafana load test result dashboard

Curious about the technical background? Want to try out Pensum for yourself? Check our Github project page for more or just reach out to us!  

  • testing
  • pensum
Arjan van Hugten
Arjan van Hugten

After his research into generating and performing load tests based on historical data, Arjan was part of the setting up of Pensum. A way to generate automatic load tests. He also works as a back-end developer with certification for Kentico, among others.