Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created October 4, 2019 11:39
Show Gist options
  • Save ppcano/7735ce473173191117b9856dc622429f to your computer and use it in GitHub Desktop.
Save ppcano/7735ce473173191117b9856dc622429f to your computer and use it in GitHub Desktop.
Performance test example
import http from "k6/http";
import { sleep } from "k6";
export let options = {
duration: '45s',
thresholds: {
"http_req_duration": ["p(99)<500"]
}
};
const BASE_URL = 'https://test-api.loadimpact.com';
export default function() {
let req;
req = http.get(`${BASE_URL}/public/crocodiles/`);
let crocs = JSON.parse(req.body);
if (crocs && crocs.length) {
req = http.get(`${BASE_URL}/public/crocodiles/${crocs[0].id}/`);
}
sleep(0.3);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment