Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/testing/k6/author-run/about-scenarios.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/testing/k6/author-run/about-scenarios/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
About test scenarios
In k6, you can configure both logic and load in a scenario. Whether you write your tests from the Test Builder or your code editor, understanding scenarios will help you model realistic load tests.
A realistic load test should account for both the behavior of its virtual users and the load that these users put on your application.
- Test logic models user behavior. What does the user do when it interacts with the system?
- Load models traffic. How many users come to interact with the system? Is the number constant or changing?
A single test can have multiple scenarios. This provides much flexibility to model realistic patterns.
Example of a scenario to model a real-world case
For example, consider the different personas and behaviors of the user base of a community-run encyclopedia. Perhaps the majority of traffic comes from readers, who mainly click links to GET new pages. However, the most data-intensive traffic may come from editors, who update pages and cause writes to the database.
Use scenarios to model diverse traffic patterns and behaviors. In the example of the community-run encyclopedia, one scenario could simulate 1000 concurrent users reading different text pages, and another could simulate 100 editors who log in and then do actions that cause writes to the application database. Each scenario could also have different load shapes (for example, ramping or constant).
Configure scenarios
In your test scripts, configure scenarios in the options object.
export const options = {
scenarios: {
Scenario_1: {
executor: "ramping-vus",
...
}- For detailed conceptual info and scenario configuration, refer to Scenarios in the k6 OSS docs.
- To declare scenarios from the Test Builder, refer to the Test Builder docs.
Tip
When designing scenarios with different load patterns and VU numbers, use the Grafana Cloud k6 calculator to compare VUH costs across different configurations and optimize your test design.
Was this page helpful?
Related resources from Grafana Labs


