Created
August 8, 2017 09:09
-
-
Save ppcano/62167b3a37b50fe16b6fce234658d052 to your computer and use it in GitHub Desktop.
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
import http from "k6/http"; | |
import {check} from "k6"; | |
import { Rate } from "k6/metrics"; | |
export let RequestErrorRate = new Rate("Request errors"); | |
export let options = { | |
vus: 50, | |
duration: "3s", | |
thresholds: { | |
"Request errors": ["rate<0.1"] | |
} | |
}; | |
export default function() { | |
const checkResult = check(http.get("http://httpbin.org"), { | |
"status is 200": (r) => r.status == 200, | |
"duration": (r) => r.timings.duration < 2000 | |
}); | |
RequestErrorRate.add(!checkResult); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment