Skip to content

Commit e9cb042

Browse files
added the ability to specify the number of iterations for k6 to run (#71)
* added ability to specify the number of iterations to run updated package.json description and version number updated readme to reflect changes added check for iterations on the LoadTesting class added iterations to the K6Options class * fixed iterations in readme
1 parent 697ced4 commit e9cb042

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

README.MD

+6
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ type K6Options = {
369369
withMutations?: boolean
370370
vus?: number
371371
duration?: string
372+
iterations?: number
372373
out?: string[]
373374
}
374375
```
@@ -431,6 +432,11 @@ You can select how many virtual users do you want for your tests, just pass to t
431432
You can select the duration for your tests, just pass to the options
432433
`duration: '<DURATION>s'`. It should be a string with units of the time e.g. `s`
433434

435+
#### Iterations
436+
437+
You can select the number of iterations to run by passing
438+
`iterations: <ITERATIONS>`. It should be an integer.
439+
434440
#### Out
435441

436442
You can also make k6 output detailed statistics in JSON format by using the --out/-o option for k6 run.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "easygraphql-load-tester",
3-
"version": "2.0.3",
4-
"description": "Create GrapgQL queries to use with test loaders.",
3+
"version": "2.0.4",
4+
"description": "Create GraphQL queries to use with test loaders.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
77
"scripts": {

src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export = class LoadTesting {
7878
const selectedVus = options?.vus || ''
7979

8080
const selectedDuration = options?.duration || ''
81+
const iterations = options?.iterations?.toString() || ''
8182

8283
fs.writeFileSync(queryFileName, JSON.stringify(queries))
8384

@@ -89,6 +90,7 @@ export = class LoadTesting {
8990
env: {
9091
K6_VUS: selectedVus.toString(), // check as string
9192
K6_DURATION: selectedDuration,
93+
K6_ITERATIONS: iterations,
9294
},
9395
})
9496

src/types/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export type ArtilleryOptions = {
2525
export type K6Options = ArtilleryOptions & {
2626
vus?: number
2727
duration?: string
28+
iterations?: number
2829
out?: string[]
2930
}
3031

0 commit comments

Comments
 (0)