Created
May 20, 2024 10:15
-
-
Save danielmackay/15d8a8bb066416276cf076fc24b21d5f to your computer and use it in GitHub Desktop.
K6 - Basic load test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// k6 run ./script.js | |
import http from 'k6/http'; | |
import { sleep, check } from 'k6'; | |
import { Rate } from 'k6/metrics'; | |
export const errorRate = new Rate('errors'); | |
export let options = { | |
insecureSkipTLSVerify: true, | |
noConnectionReuse: false, | |
vus: 30, // number of virtual users | |
duration: '2m', // duration of the test | |
}; | |
export default function () { | |
const url = 'https://localhost:7255/heroes'; | |
check(http.get(url), { | |
'status is 200': (r) => r.status == 200, | |
}) || errorRate.add(1); | |
sleep(1); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment