Skip to content

Commit

Permalink
added the ability to specify the number of iterations for k6 to run (#71
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
cameron-russell authored Mar 19, 2020
1 parent 697ced4 commit e9cb042
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ type K6Options = {
withMutations?: boolean
vus?: number
duration?: string
iterations?: number
out?: string[]
}
```
Expand Down Expand Up @@ -431,6 +432,11 @@ You can select how many virtual users do you want for your tests, just pass to t
You can select the duration for your tests, just pass to the options
`duration: '<DURATION>s'`. It should be a string with units of the time e.g. `s`

#### Iterations

You can select the number of iterations to run by passing
`iterations: <ITERATIONS>`. It should be an integer.

#### Out

You can also make k6 output detailed statistics in JSON format by using the --out/-o option for k6 run.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "easygraphql-load-tester",
"version": "2.0.3",
"description": "Create GrapgQL queries to use with test loaders.",
"version": "2.0.4",
"description": "Create GraphQL queries to use with test loaders.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export = class LoadTesting {
const selectedVus = options?.vus || ''

const selectedDuration = options?.duration || ''
const iterations = options?.iterations?.toString() || ''

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

Expand All @@ -89,6 +90,7 @@ export = class LoadTesting {
env: {
K6_VUS: selectedVus.toString(), // check as string
K6_DURATION: selectedDuration,
K6_ITERATIONS: iterations,
},
})

Expand Down
1 change: 1 addition & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type ArtilleryOptions = {
export type K6Options = ArtilleryOptions & {
vus?: number
duration?: string
iterations?: number
out?: string[]
}

Expand Down

0 comments on commit e9cb042

Please sign in to comment.