00:00 Intro
00:14 Topics
00:48 Gatling Project Setup
01:49 Prerequisites
03:35 How to setup Maven
08:12 IDE IntelliJ Idea Setup
More on IntelliJ Idea: • IntelliJ IDEA
14:05 2 Options for project creation
14:15 Option 1 - Create a new Project using Maven
22:33 Option 2 - Clone existing Gatling Project
23:58 Clone project on IDE IntelliJ
31:01 Record & Run tests from Project
37:24 Gatling Script Preparation
37:47 Demo example for script preparation
46:13 Gatling Script Execution
47:49 Gatling Recorder UI Explanation
48:36 Follow Redirects:
50:14 Infer HTML Resources:
51:44 Automatic Referrers:
52:38 Remove Cache Headers:
54:04 Save and Check Response Bodies:
55:00 Summary and next steps
---
Prerequisites
JDK
javac -version
Scala
scala -version
(can skip if the IDE has option to add scala plugin)
Maven
mvn -v
IDE
any IDE that supports Scala programming
Eclipse, IntelliJ, Netbeans etc
Project Setup
Step 1 - Check JDK and Scala are installed on the system
javac -version
scala -version (optional)
Step 2 - Open IntelliJ and add Scala plugin
Step 3 - Create a Gatling Project
Option 1 - Create a new Project using Maven
Option 2 - Clone existing Project
Option 1 - Create a new Project using Maven
1. Create a folder > Open CMD > navigate to folder > run command mvn archetype:generate
2. Provide archetype gatling
3. Choose latest version
4. Define a groupId e.g. com.gatling.tests
5. Provide an artifactId e.g. GatlingProject
6. Open/Import project in IDE (IntelliJ IDEA)
Option 2 - Clone existing Project
Search for Gatling maven project github (check the latest projects)
Java - https://github.com/gatling/gatling-ma...
Scala - https://github.com/gatling/gatling-ma...
Clone or download
Open/Import project in IDE (IntelliJ IDEA)
In IDE like IntelliJ we can directly clone project from VCS - File > New > Project from Version Control
For Scala project:
scala -version (not needed if scala plugin added on IntelliJ IDE)
check scala plugin is added in the IDE (File - Settings - Plugins)
can add scala in Project Libraries (File - Project Structure - Global Libraries - Scala)
In case the scala and resources folder not already marked
Rt click on scala folder > Mark Directory as > Test Sources root
Rt click on resources folder > Mark Directory as > Test Resources root
Record & Run tests from Project
Gatling - Record Test
Step 1 - Demo of the scenario to test
Step 2 - On Chrome browser - More Tools > Developer Tools - Goto Network tab
Step 3 - Clear any earlier logs, check Preserve log, start Recording network logs
Step 4 - Record the scenario
Step 5 - Save or Export HAR file
Step 6 - Goto Gatling Project > Recorder class > Rt click > Run Recorder
Recorder window opens
Change recorder mode to HAR Convertor
Browser and add HAR file
Provide package and class name
Click No Static Resources Start
Step 7 - Check the script in IDE
Gatling Script Preparation
Step 1 - Open Gatling script in IDE
Step 2 - Remove Header Maps if any and their references in script
Step 3 - Update request names > Save
Step 4 - Understand Gatling Script
Protocol Setup
Scenario Definition
Load Simulation Design
Gatling Script Execution
Step 1 - Goto Engine Class > Rt click > Run Engine
Step 2 - Provide options as needed on the console
Step 3 - Check the report
Gatling Recorder
Gatling Recorder Checkboxes
Follow Redirects:
Checked: Gatling Recorder will automatically follow HTTP redirects (e.g., 301, 302, 307) during recording
Infer HTML Resources:
Checked: the recorder analyzes recorded responses and automatically adds requests for necessary HTML resources (CSS, JavaScript, images) embedded within the main page.
This helps build a more complete simulation mimicking realistic browser behavior
Automatic Referrers:
Checked: Gatling Recorder will automatically set the Referer header in requests based on the previous request’s URL.
Useful for simulating realistic user behavior where subsequent requests refer back to the previous page
Remove Cache Headers:
Checked: Gatling Recorder will automatically remove cache-related headers (e.g., If-Modified-Since, If-None-Match) from requests.
This ensures requests always fetch fresh data from the server, avoiding potential caching issues during testing
Save and Check Response Bodies:
Checked: the recorder stores the response body content for each captured request.
Allows for validating responses using checks (e.g., verifying specific content, status codes, etc.).
Document link - https://tinyurl.com/GatlingDoc1-Ragha...
---
If my work has helped consider helping an animal near you in any way you can
Never Stop Learning
Raghav Pal
https://AutomationStepByStep.com/
▬▬▬
Смотрите видео Gatling Step by Step Masterclass | Part 2 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Automation Step by Step 29 Февраль 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,112 раз и оно понравилось 20 людям.