Skip to content

2020

Gatling: Post requests and modular scripts

This article is the fourth part of a series of tutorials dedicated to Gatling Load Testing.

We will focus on POST requests and script modularization:

In the previous blog post we created a realistic Virtual User that browses the store without buying anything. On the contrary, here we are going to simulate the behavior of a user that connects to the web store, searches for items, adds some to his cart and proceeds to the checkout. Then we will combine both Virtual Users to simulate a diverse load on the PetStore.

POST Requests

Most actions to simulate a user that connects to the store are done via POST HTTP requests. But what exactly is an HTTP POST request?

Statistical Analysis in Performance Testing

What does statistical analysis have to do with performance testing you may ask, more than you would think is the answer.

Due to the large volumes of result data that is generated and analysed you are performing statistical analysis of your data when presenting your results. - 90th Line, - 95th Line, - 99th Line, - Average, - Median.

Are all examples of values in the JMeter Aggregate Report.

  • Average,
  • Std.Dev.

Are examples of values in the JMeter Summary Report as well as the Graph Results.

We are going to take a look at these statistical techniques so you can understand, if you don’t already know, how they are calculated as well as how they can be of benefit when analysing performance test results.

We will also look at other statistical techniques that you can use outside of JMeter by using the .jtl file output, we will use Microsoft Excel for our analysis but other spreadsheet type tools are equally as good.

As way of a disclaimer there are many ways of analysis data, far too many to go into in this Blog Post but hopefully reading this will encourage you to explore this subject further as it can be fascinating.

For each way of analysing the results we will look at its definition, look at an example and discuss how it can be of use when presenting results.

Let’s get started.

Angular: How to use Virtual Scroll with a Flat Tree?

While developing OctoPerf's frontend I quickly stumbled upon performance issues with Angular Material tree when too many nodes where opened. OctoPerf is a load testing solution. As such, it displays a tree of actions and containers used to script the load testing scenarios:

Actions tree

With hundreds of directories expanded, the frontend quickly became slow to the point of being unusable. By default, even nodes outside of the visible part of the tree are rendered in the DOM. Since this feature is not directly available yet, I had to switch from a classic CSS scrollbar to a Virtual Scroll manually. This blog post lists all the steps I had to follow in order to use a Virtual Scroll on a complex Material Tree.

Note:

The actions tree in octoPerf uses a FlatTreeControl to manage the data. It is probably quite harder (or even impossible) to use a Virtual Scroll with a NestedTreeControl!

Modularisation in JMeter

The key to all good automation is modularisation which is effectively isolating small chunks of your application under test into separate tests and then re-using these smaller chunks in your larger, more complicated tests. Example of good candidates for modularisation are logon and logoff as well as any other high-volume journeys through your application such as search functionality.

The rationale for this approach is that if these high volume common functional activities change you only need to make the update in a single test rather than in multiple tests. If your business functionality is only used once in a single script rather than many scripts it makes no sense to modularise it but if it is used twice, or more, then it should be considered.

Sample JMX files for this tutorial are available for download:

Analyze your load tests

OctoPerf's report engine provides many graphs to sort and presents test metrics in a comprehensive way. We've tried to improve it over the years so that you can access critical information very quickly. But requirements vary from one project to the other.

In this post we will look at how you can configure the report to show your preferred metrics, and also all the shortcuts you can take to achieve this goal.

The best example is the Report summary, it allows you to navigate between all the items in a few clicks:

report-summary