This project will handle the load tests for backend API.
Include:
- Regular request (
load_scripts/backend-api/manifest.js
) - Login simple request (
load_scripts/backend-api/login.js
) - JWT Request (including token request) (
load_scripts/backend-api/checkToken.js
) - Random payload generated requests (using Faker.js) (
load_scripts/backend-api/register.js
)
The scripts provide a simplified visual report with testings and validations
There is an easy option to debug any performance issue using a full featured dashboard.
As well is possible to check details in depth.
npm run infra:build # Build docker-compose
npm run infra:start # Up docker-compose
npm run infra:stop # Down docker-compose
You should create a .env
file at the same level as the docker-compose.yml
. Those environmental variables will be injected to the K6 docker image.
Variables needed:
BACKEND_BASE_URL
USER_EMAIL
USER_PASS
npm run infra:start
By default there is no dashboard attached to Grafana. So please follow the steps.
- Enter to import dashboard: http://localhost:3000/dashboard/import
- Add
2587
toGrafana.com Dashboard
and click `Load`` - On the new screen select
myfluxdb
as the value fork6
field and clickimport
- You will redirected to the dashboard
Update the .env
with the information needed.
Note: If you need to access to a running server outside the container, you can use host.docker.internal
, like:
BACKEND_BASE_URL=http://host.docker.internal:4000
To run the tests:
npm run load-test:run