Рет қаралды 816
00:00 Intro
00:56 What is Correlation (Chaining)
02:38 Demo of Correlation in Gatling
10:52 How to use Correlation in Gatling Scripts
14:32 How to use Regular Expression
28:20 How to run maven commands
32:30 How to run specific test simulation
34:39 How to run multiple test simulation
37:04 Assertions
40:58 Assertions scope
47:37 Gatling with VCS and CI Tools
49:28 Gatling Enterprise
01:11:11 Before doing any Performance Testing
01:16:23 Summary and next steps
What is Correlation
The process of extracting some value from the response of a step and referring it into the request of other subsequent step is called correlation
(Referencing is done dynamically - at runtime)
Dynamic Referencing
Extract dynamic value from the response of a step
Refer the extracted value in the request of a subsequent step
Why is it required
In a Test there may be a need to refer values from earlier steps which cannot be determined prior to test execution as these are generated at runtime
D E M O
How to use Correlation with
JSON Path
Regular Expression
in Gatling Scripts
Command Line
How to run maven commands
How to run specific test simulation
How to run multiple test simulation
Open command line and goto the location of project folder
Try these commands:
mvn -version
mvn clean gatling:help
mvn clean gatling:verify
mvn clean gatling:recorder
mvn clean gatling:test
mvn clean gatling:test -Dgatling.simulationClass=com….Sim1
Can try running the Engine and Recorder classes manually and check
To run Multiple Simulations with mvn gatling:test
Add runMultipleSimulations in pom.xml
Ref: gatling.io/docs/gatling/refer...
Assertions
How to add Assertions
Assertions allow you to set expectations on metrics like response time, number of failed requests, throughput
Assertions are defined within the setUp block
Step 1 - Create a Simple Gatling Simulation script
Step 2 - In the setUp section add assertions
setUp(
scn.inject(atOnceUsers(1)).protocols(httpProtocol)
).assertions(
global.responseTime.max.lt(500), // Max response time should be less than 500 ms
global.successfulRequests.percent.gt(95) // At least 95% successful requests
)
Step 3 - Run the test and check reports
Assertions Examples
global.responseTime.max.lt(100) // Maximum response time should be less than 100 milliseconds
global.requestsPerSec.gt(50) // At least 50 requests per second
global.successfulRequests.percent.gt(95) // At least 95% successful requests
global.failedRequests.count.lt(10) // Less than 10 failed requests
global.responseTime.percentile(99).lt(200) // 99th percentile response time should be less than 200 milliseconds
details("MyRequest").failedRequests.percent.lt(5) // For request named "MyRequest", less than 5% failures
Assertions Scope
global: use statistics calculated from all requests
forAll: use statistics calculated for each individual request
details(path): use statistics calculated from a group or a request
//global assertions
setUp(scn.inject(atOnceUsers(10)).protocols(httpProtocol))
.assertions(
global.responseTime.max.lt(500), // Max response time should be less than 500 ms
global.successfulRequests.percent.gt(95) // At least 95% successful requests
)
// forAll assertions
setUp(scn.inject(atOnceUsers(10)).protocols(httpProtocol))
.assertions(
forAll.failedRequests.percent.lt(5) // Less than 5% failed requests
)
// details assertions
setUp(scn.inject(atOnceUsers(10)).protocols(httpProtocol))
.assertions(
details("Create Computer").responseTime.percentile3.lt(200) // 3rd percentile response time < 200 ms
)
Gatling with VCS Tool
Gatling with Git - • Gatling Beginner Tutor...
Gatling Enterprise
What is Gatling Enterprise
How to setup Gatling Enterprise on Cloud
Explore Gatling Enterprise Web UI
How to upload and run tests on Gatling Enterprise
Gatling with CI Tool
Gatling with Jenkins - • Gatling Beginner Tutor...
Jenkins + Git - • Gatling Beginner Tutor...
Before doing any Performance Testing…
Always do ethical performance testing
Never do performance testing on your primary systems/devices
Never do performance testing on primary accounts/apps
Always use separate test systems and accounts
Setup a separate QA/Test env for performance testing
Always test with same infrastructure, configuration, network
Get the metrics for performance test or create a baseline
Create realistic tests (add breathing/think time)
Always take written permissions from the owners/clients/managers
Always document your results
Document - tinyurl.com/GatlingDoc1-Ragha...
▬▬▬▬▬▬▬
Share with all who may need this
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
AutomationStepByStep.com/
▬▬