Send test results to Grafana Cloud
In this milestone, you send your k6 test results to Grafana Cloud for real-time visualization and analysis.
In the main menu, go to Testing & synthetics > Performance > Settings.
Under Access, click Personal token, then copy your API token. You’ll use it in the next step to authenticate k6. For other token types, refer to Authenticate on the CLI.
In your terminal, navigate to the directory where you saved your
script.jsfile, then log in to Grafana Cloud k6:k6 cloud login --token YOUR_API_TOKEN --stack YOUR_STACK_URLReplace
YOUR_API_TOKENwith the token you copied. ReplaceYOUR_STACK_URLwith your stack URL (for example,https://my-team.grafana.net) or stack slug (for example,my-team).Run your test with the
--local-executionflag to stream results to Grafana Cloud:k6 cloud run --local-execution script.jsAfter the test completes, scroll up in your terminal output and find the
output:line. It contains a URL like:output: cloud (https://your-stack.grafana.net/a/k6-app/runs/...)Copy this URL — it links to your test results in Grafana Cloud. You’ll use it in the next milestone to view your results.
In the next milestone, you analyze your test results in Grafana Cloud dashboards.