This example's objective is to show how you can run load tests enhanced with trace-based testing using Tracetest Cloud and k6 against an instrumented service (Pokeshop API).
For more detailed information about the K6 Tracetest Binary take a look a the docs.
- Signing up to app.tracetest.io.
- Creating an environment.
- Having access to the environment's agent token.
- Install the Tracetest CLI.
- Copy the
.env.template
file into.env
and add theTRACETEST_API_KEY
. This is the Agent API token from your environment. - Create a token from your environment.
- Run the project by using docker-compose:
docker-compose run k6-tracetest
(Linux) ordocker compose run k6-tracetest
(Mac). - After the load test finishes you should be able to see an output like the following:
docker compose run k6-tracetest
WARN[0000] The "TRACETEST_SERVER_URL" variable is not set. Defaulting to a blank string.
[+] Running 1/1
✔ demo-api Pulled 1.4s
[+] Creating 5/0
✔ Container tracetest-k6-tracetest-agent-1 Running 0.0s
✔ Container tracetest-k6-cache-1 Running 0.0s
✔ Container tracetest-k6-queue-1 Running 0.0s
✔ Container tracetest-k6-postgres-1 Running 0.0s
✔ Container tracetest-k6-demo-api-1 Running 0.0s
[+] Running 3/3
✔ Container tracetest-k6-postgres-1 Healthy 0.5s
✔ Container tracetest-k6-cache-1 Healthy 0.5s
✔ Container tracetest-k6-queue-1 Healthy 0.5s
[+] Running 1/1
✔ demo-api Pulled 1.4s
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: /import-pokemon.js
output: xk6-tracetest-output (TestRunID: 39663)
scenarios: (100.00%) 1 scenario, 1 max VUs, 35s max duration (incl. graceful stop):
* default: 1 looping VUs for 5s (gracefulStop: 30s)
After running the initial set of tests, you can click the run link for any of them, update the assertions and run the scripts once more. This flow enables complete a trace-based TDD flow.