Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.