Skip to content

Commit a567efe

Browse files
[feat] simplify running k6
- No gerund headings - simpler explanation
1 parent 65482df commit a567efe

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/data/markdown/translated-guides/en/01 Get started/03 Running k6.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Follow along to learn how to:
1212
With these example snippets, you'll run the test with your machine's resources.
1313
But, if you have a k6 Cloud account, you can also use the `k6 cloud` command to outsource the test to k6 servers.
1414

15-
## Running local tests
15+
<!-- preserving old anchor --->
16+
## Run local tests {#running-local-tests}
1617

1718
To run a simple local script:
1819
1. Copy the following code, paste it into your favorite editor, and save it as `script.js`:
@@ -31,7 +32,7 @@ To run a simple local script:
3132

3233
</CodeGroup>
3334

34-
1. Then, run k6 with this command:
35+
1. Run k6 with the following command:
3536

3637
<CodeGroup labels={["CLI", "Docker", "Docker in Win PowerShell"]}>
3738

@@ -55,7 +56,7 @@ To run a simple local script:
5556

5657
</CodeGroup>
5758

58-
## Adding more VUs
59+
## Add VUs {#adding-more-vus}
5960

6061
Now run a load test with more than one virtual user and a longer duration:
6162

@@ -77,11 +78,16 @@ PS C:\> cat script.js | docker run --rm -i grafana/k6 run --vus 10 --duration 30
7778

7879
_Running a 30-second, 10-VU load test_
7980

80-
k6 works with the concept of _virtual users_ (VUs), which run your test scripts.
81+
<Blockquote mod="note" title="Virtual users">
82+
83+
k6 runs multiple interations in parellel with _virtual users_ (VUs).
84+
In general terms, more virtual users means more simulated traffic.
85+
8186
VUs are essentially parallel `while(true)` loops.
8287
Scripts are written in JavaScript, as ES6 modules,
8388
so you can break larger tests into smaller pieces or make reusable pieces as you like.
8489

90+
</Blockquote>
8591

8692
### The init context and the default function
8793

@@ -90,7 +96,7 @@ For a test to run, you need to have *init code*, which prepares the test, and *V
9096
Code in the init context defines functions and configures the test options (like `duration`).
9197

9298
Every test also has a `default` function.
93-
This function defines the entry point for your VUs.
99+
This function defines the logic for your VUs.
94100

95101
<CodeGroup labels={[]}>
96102

@@ -106,13 +112,12 @@ export default function () {
106112

107113
Init code runs first and is called only once per VU.
108114
On the other hand, default code executes as many times as the test options set.
115+
To learn more, read about [The test lifecycle](/using-k6/test-lifecycle).
109116

110-
- [The life cycle of a k6 test](/using-k6/test-lifecycle).
111-
112-
## Using options
117+
## Set options {#using-options}
113118

114119
Instead of typing `--vus 10` and `--duration 30s` each time you run the script,
115-
you can include the options in your JavaScript file:
120+
you can set the options in your JavaScript file:
116121

117122
<CodeGroup labels={["script.js"]} lineNumbers={[true]}>
118123

@@ -131,7 +136,7 @@ export default function () {
131136

132137
</CodeGroup>
133138

134-
Then, run the script without those options on the command line:
139+
If you run the script without flags, k6 uses the options defined in the script:
135140

136141
<CodeGroup labels={["CLI", "Docker", "Docker in Win PowerShell"]}>
137142

@@ -149,7 +154,7 @@ PS C:\> cat script.js | docker run --rm -i grafana/k6 run -
149154

150155
</CodeGroup>
151156

152-
## Stages: ramping up/down VUs
157+
## Ramp VUs up and down in stages {#stages-ramping-up-down-vus}
153158

154159
You can ramp the number of VUs up and down during the test.
155160
To configure ramping, use the `options.stages` property.
@@ -178,7 +183,7 @@ export default function () {
178183

179184
</CodeGroup>
180185

181-
For advanced ramping, you can use [scenarios](/using-k6/scenarios) and the `ramping-vus` executor.
186+
For more granular ramp configuration, you can use [scenarios](/using-k6/scenarios) and the `ramping-vus` executor.
182187

183188
## Execution modes
184189

0 commit comments

Comments
 (0)