Created
October 4, 2019 11:39
-
-
Save ppcano/7735ce473173191117b9856dc622429f to your computer and use it in GitHub Desktop.
Performance test example
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 { 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