Gatling Test Results for Each Parameter in Console

Gatling Test Results for Each Parameter in Console

Overview

In our previous blog – Parameterization in Gatling Stress Test Tool, we discussed about performance testing of services by parameterizing input data from CSV data source. In this blog, we will discuss about viewing test results of each parameter in an API in Gatling console.

Use Case

Consider an API with 10 different parameters. Let us discuss on finding the performance of individual parameters and its test results such as pass or fail.

Structure Elements – Exec

The “.exec()” method is used to execute the API’s hits in server during simulation. The structure of the Gatling HTTP module is as follows:

select

On executing the scenario, the content in the “.exec()” method will be displayed in the console and in the reports.

Expression Function

The “.exec()” method can also be passed as an Expression function. Gatling DSL methods can be passed as Expression Language Strings. Using the Expression function, the dynamic values available in the feeders can be processed.

select

On executing the scenario, the “.exec()” method displays value data of the ‘dynamicValue’ of the session in console. It is used to manually edit and debug the data in session.

Let us discuss in detail about declaring VehicleCount label in the “.exec()” method with the following scenario.

Defining EL Label in Exec

EL works only when the simulation is instantiated and passes the value to DSL method. Using Feeder concept, inject the vehicle count parameter values dynamically to the method at runtime. The VehicleCount label record will be automatically fetched out of the Feeder and will be injected into the session so as to generate a new session instance. Reports will be generated for each new instance.

select

Note: VehicleCount parameter values are available in CSV Feeder. ‘.random’ RecordSeqFeederBuilder is used to inject the random parameters in this scenario.

select

Performance Report for Each Parameter

The performance report for each parameter is shown in HTML format as follows:

select

Test Status Report for Each Parameter

The test status such as pass or fail for each parameter is shown in the Gatling console as follows:

select

CSV Feeder File

Create the CSV file in the below directory:

For example, create CSV data source as “vehicle.csv”.

select

Code

select

References

676 Views 3 Views Today