-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.js
29 lines (20 loc) · 823 Bytes
/
sample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import prompt from "k6/x/prompt"
import http from 'k6/http'
import {check} from 'k6';
export const options = {
vus: __ENV.vus ? __ENV.vus : prompt.readInt("total vus"),
duration: __ENV.duration ? __ENV.duration : prompt.readString("duration seconds (s)"),
}
export default function () {
// Define options
const options = ["smoke", "load"]
// Read type from __ENV or Prompt
const selected = __ENV.type ? __ENV.type : prompt.select("type of test", ...options)
const id = __ENV.env ? __ENV.env : prompt.readString("photo id (from 1 up to 100): ")
// Print values
console.log("values entered by the user: ", selected, selected3)
let res = http.get('https://jsonplaceholder.typicode.com/photos/' + id)
check(res, {
'is status 200': (r) => r.status === 200,
});
}