Last active
August 19, 2021 12:49
-
-
Save lukecav/7720716d7e31058d1456a17f580505dd to your computer and use it in GitHub Desktop.
k6 - stages ramping example script
This file contains hidden or 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
import http from "k6/http"; | |
import { check } from "k6"; | |
/* | |
* Stages (aka ramping) is how you, in code, specify the ramping of VUs. | |
* That is, how many VUs should be active and generating traffic against | |
* the target system at any specific point in time for the duration of | |
* the test. | |
* | |
* The following stages configuration will result in up-flat-down ramping | |
* profile over a 150s total test duration. | |
*/ | |
export let options = { | |
stages: [ | |
// Ramp-up from 1 to 60 VUs in 60s | |
{ duration: "60s", target: 60 }, | |
// Stay at rest on 60 VUs for 60s | |
{ duration: "60s" }, | |
// Ramp-down from 60 to 0 VUs for 30s | |
{ duration: "30s", target: 0 } | |
] | |
}; | |
export default function() { | |
let res = http.get("https://woocommerce-test.rcfjx3-liquidwebsites.com/"); | |
check(res, { "status is 200": (r) => r.status === 200 }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/loadimpact/k6/tree/master/samples
http://support.loadimpact.com/knowledgebase/topics/23898-scripting-examples
https://docs.k6.io/docs