gatling-sample-framework/README.md

77 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

2024-10-25 22:12:59 +00:00
# Simple Gatling Load Test Framework
This repository is a proof-of-concept demonstration of the Gatling load testing tool, in a standard Java/Scala test framework.
Here is what you need to run one of the load simulations provided in this demo:
## Requirements
* Java 17 or better
* Apache Maven 3.9 or better
* Docker 27 or better (for the docker image runs)
The maven tool will install all other necessary dependencies from Maven Central, including:
* Scala 3 Libraries
* Gatling SDK
* Scala and Gatling runner plugins
## Running The Tests
There are two ways to run a test:
* As a docker container
* On the native environment of your local machine
### Docker Runs
To run a test as a docker container, use the `docker-run` scripts. A version has been
created for both Windows and Linux/Mac host environments.
The `docker-run` script takes arguments that allow you to control the load profile
of the test. It also takes arguments that enable the use of different test users.
Here is example usage:
Powershell
```powershell
.\docker-run.ps1 -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15
```
Bash
```bash
./docker-run.sh -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15
```
### Local Runs
To run a test from your workstation, use the `local-run` scripts. A version has been created for both Windows and Linux/Mac host environments.
The `local-run` script takes arguments that allow you to control the load profile of the test. It also takes arguments that enable the use of different test users. Here is example usage:
Powershell
```powershell
.\local-run.ps1 -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15
```
Bash
```bash
./local-run.sh -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15
```
Arguments for both the docker and local scripts:
* The `-test` argument requires you to supply the classname of the test you want to execute.
These can be found in the `com.organization.tests` classpath in your source directory. The
basic naming convention is Java-style. However, an arbitrary test id has been attached to the
beginning of the test name, to make it easier to locate in the test plan document.
* `-user` and `-pswd` should just be whatever test user credentials will be used for the test session user population.
* `-count` is the total number of test users to be instantiated during the test. It should be
noted that the total number of users *may not be* the *peak* number of users. That will
depend upon the next two arguments.
* `-ramp_in_minutes` is the number of minutes over which your user population will inject itself into the scenario
* `-duration_in_minutes` is the number of minutes the scenario should sustain the total population in the test