Skip to content

Commit bfc0b53

Browse files
committed
docs: update README
1 parent 9187e11 commit bfc0b53

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,44 @@
11
# Running Artillery tests in parallel with GitHub Actions
22

3+
This is an example showing how you can run multiple Artillery load tests in parallel on GitHub Actions with the [matrix strategy](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow).
4+
5+
## Code structure
6+
7+
1. The main Artillery configuration file is in [`config.yml`](./config.yml). This defines our target and load phases. In a more realistic test it would also include plugin configuration, load custom JS/TS code, etc.
8+
2. We have 3 different VU scenarios defined in files under `scenarios`, e.g. [`scenarios/armadillo.yml`](./scenarios/armadillo.yml).
9+
10+
Our goal is to run 3 Artillery load tests in parallel, using the config file with each individual scenario file.
11+
12+
## GitHub Actions workflow
13+
14+
Our workflow definition is in [`.github/workflows/run-artillery-tests.yml`](./.github/workflows/run-artillery-tests.yml).
15+
16+
To run 3 Artillery load tests in parallel we define a matrix containing the names of our scenarios:
17+
18+
```yaml
19+
matrix:
20+
# Create a scenario_name variable in this job that will be used to
21+
# run an Artillery test for that scenario
22+
scenario_name:
23+
- armadillo
24+
- dino
25+
- pony
26+
```
27+
28+
That creates a `scenario_name` variable in the workflow which we can use to run an Artillery load test as a GitHub Actions job:
29+
30+
```yaml
31+
- name: Run Artillery tests in parallel
32+
run: |
33+
artillery run scenarios/${{matrix.scenario_name}}.yml --config config.yml
34+
```
35+
36+
GitHub Actions will automatically create a job for each option we define in the matrix. The end result looks like this:
37+
38+
3 jobs running in parallel, one for each scenario:
39+
40+
![checks](./images/checks.png)
41+
42+
The workflow view in the **Actions** tab:
43+
44+
![ui](./images/jobs.png)

images/checks.png

54.3 KB
Loading

images/jobs.png

27.7 KB
Loading

0 commit comments

Comments
 (0)