Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created August 8, 2017 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppcano/62167b3a37b50fe16b6fce234658d052 to your computer and use it in GitHub Desktop.
Save ppcano/62167b3a37b50fe16b6fce234658d052 to your computer and use it in GitHub Desktop.
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