performance-testing/README.md

48 lines
776 B
Markdown
Raw Normal View History

2023-09-26 09:02:57 +00:00
# performance-testing
2023-09-26 10:52:17 +00:00
The code from my YouTube video on "How to do Performance Testing with k6"
2023-09-27 08:51:36 +00:00
You first need to run the API which you can do in 2 ways.
Using dotnet:
2023-09-26 10:52:17 +00:00
```sh
cd src
dotnet run
```
2023-09-27 08:51:36 +00:00
Using Docker:
```sh
docker-compose up
```
2023-09-26 10:52:17 +00:00
Then in a seperate terminal window run the tests using the commands below.
2023-09-27 08:51:36 +00:00
Note if you want to run these scripts against an API hosted on another machine you can use the HOSTNAME environment variable. e.g.
```sh
k6 run -e HOSTNAME=192.168.1.1:5157 tests/simple-test.js
```
2023-09-26 10:54:16 +00:00
## Simple Test
```sh
2023-09-27 08:51:36 +00:00
k6 run tests/simple-test.js
2023-09-26 10:54:16 +00:00
```
2023-09-26 10:52:17 +00:00
## Stress Test
```sh
2023-09-27 08:51:36 +00:00
k6 run tests/stress-test.js
2023-09-26 10:52:17 +00:00
```
2023-09-27 08:51:36 +00:00
## Load Test
2023-09-26 10:52:17 +00:00
```sh
2023-09-27 08:51:36 +00:00
k6 run tests/load-test.js
2023-09-26 10:52:17 +00:00
```
2023-09-27 08:51:36 +00:00
## Spike Test
2023-09-26 10:52:17 +00:00
```sh
2023-09-27 08:51:36 +00:00
k6 run tests/spike-test.js
2023-09-26 10:52:17 +00:00
```
## Soak Test
```sh
2023-09-27 08:51:36 +00:00
k6 run tests/soak-test.js
2023-09-26 10:52:17 +00:00
```