https://github.com/chrispsheehan/performance-test-framework
Run performance tests against an API using k6.
https://github.com/chrispsheehan/performance-test-framework
docker k6 performance-testing test-automation typescript
Last synced: about 1 month ago
JSON representation
Run performance tests against an API using k6.
- Host: GitHub
- URL: https://github.com/chrispsheehan/performance-test-framework
- Owner: chrispsheehan
- Created: 2021-03-31T13:07:01.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-16T13:14:14.000Z (over 1 year ago)
- Last Synced: 2023-10-17T02:58:20.431Z (over 1 year ago)
- Topics: docker, k6, performance-testing, test-automation, typescript
- Language: TypeScript
- Homepage:
- Size: 345 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# PerformanceTestFramework
These example tests are currently pointed at the [MockApp](MockApp), which is hosted in Docker.
To target another URI remove the ``mock`` service and set the ``APP_DOMAIN`` environmental variable within the [docker-compose](docker-compose.yaml) file.
References:
- [TypeScript](https://www.typescriptlang.org/)
- [k6](https://k6.io/)
- [Example](https://github.com/go-automate/k6-typescript-framework)
- [Using node modules i.e. faker](https://github.com/k6io/template-es6)
- [Mock api repository](https://github.com/chrispsheehan/simple-mock)## Build code in docker
```bash
docker run -i --rm -v ${PWD}/:/app node:16.5-alpine npm run build --prefix /app
```## Run in docker-compose
- The below command will;
- Start a target mock api
- Execute the tests via k6```bash
docker-compose run --rm k6-runner && docker-compose stop
```## Tags
Tags are used to separate results from one another as documented [here](https://k6.io/docs/using-k6/tags-and-groups/#tags).
```ts
headers.tags = { tag: "getuser" };
```## Thresholds
Thresholds are set on a per tag basis as documented [here](https://k6.io/docs/using-k6/thresholds/#thresholds-on-tags).
- **p(95)<2000** 95% of requests to run in 5 seconds or less.
- **rate<=0.01** 99% of requests successful.```ts
export let options = {
thresholds: {
"http_req_duration{tag:getuser}": ['p(95)<10000'],
"http_req_failed{tag:getuser}": ['rate<=0.01'],"http_req_duration{tag:createuser}": ['p(95)<2000'],
"http_req_failed{tag:createuser}": ['rate<=0.01'],
},
};
```## Gotchas
- ERROR: `no matching manifest for linux/arm64/v8 in the manifest list entries`
- FIX: add `platform: linux/x86_64` to docker-compose