Tutorials 17 October 2018

The Easiest Way to Create (Realistic) Load Test Scripts

John Emmitt

So, you want to load test your website or web application to see if it will handle the expected normal and peak user traffic. How can you create a realistic test script that captures a typical user journey in your app?

The easiest way to do this is to record a browser session. Use a tool such as the Load Impact k6 Test Script Recorder, available in the Chrome Web Store.

k6 Test Script Recorder in Google Web Store

The Load Impact k6 Test Script Recorder allows you to capture a typical user session simply by browsing like a user would on your site, or by doing various tasks in your web app. It will capture everything – every single HTTP(s) request being generated by the browser as you click – including ads, images, documents, etc., so you get a far more accurate test of your site or app.

Note: The recorder will not record other browser tabs or pop up windows. If you need to capture this type of activity, you should check out this article: How to convert HAR to k6 test.

Here are the steps to start using the Load Impact k6 Test Script Recorder:

1. Download Chrome Extension

Chrome Extension Button

2. Start Recording-- Open the recorder by clicking on the Load Impact icon in the upper right corner of your browser window, press "Start recording,” and start browsing in your current browser tab.


3. Stop Recording-- When done browsing, click "Stop" recording. You'll be taken to the Load Impact app to review the test script. (To create your Load Impact account click here)


4. Save your test script-- save the recorded test script in any of your k6 projects, review the code and click "run."


The test script that you get as a result of recording a browser session is JavaScript. You can edit this script in the Load Impact in-app script editor. This allows you to create more complex test scripts, as needed. For example, you may want to use parameterized data to handle a login process. The sky's the limit once you have a realistic user test scenario!

< Back to all posts