@Yusuf One of the options is to output data to a file with one script. Another script unloads the required values from the file.
Example:
- To write to the file, you will need to display the required values in log
cosole.log(response)
and run the script with parametersk6 run test.js 2>resp.txt
and then use the resp.txt file. And example this and this - Try to use the setup function. @ned wrote about the possibility of overriding the timeout..
import http from 'k6/http';
export function setup() {
let params = {
timeout: "120s"
};
const res = http.get('https://httpbin.org/get', params);
return { data: res.json() };
}
export default function (data) {
console.log(JSON.stringify(data));
}
- Change the timeout in the default function as described above and place the data acquisition in 1 iteration.
if(__ITER == 0){
// Get values here
}