Can anybody help me out?
I try to use sleep like this:
But , ‘ReferenceError:sleep is not defined’ shows when run this script.
Anything wrong? Could you please give an example , really appreciate!
Can anybody help me out?
I try to use sleep like this:
Hi @jessie
Welcome back!
Can you test a simpler example like this one:
import http from 'k6/http';
import { group, sleep } from 'k6';
export default function () {
group('main', function () {
http.get('https://test.k6.io');
group('sub', function () {
http.get('https://httpbin.test.k6.io/anything');
sleep(1);
});
http.get('https://test-api.k6.io');
});
}
The output for me, using version 0.42.0
is:
If you get the same error with the script above, can you share the k6
version you are using? Maybe it’s an older version. Once the simpler script works we can try to figure out the differences with yours. Since you did not share the complete (sanitized) script I can’t be sure.
Cheers!
Hi @eyeveebe
Really thanks for your help.
I tested this simpler example and it works. Then I tried my scripts again and most of them worked fine, I have compared the only one wrong script with yours again and again. Then I found that the one that was wrong was because the sleep function was not imported!
Sorry to bother you and your team with my stupid mistakes
Thanks again.
Hi @jessie
I’m very happy to hear you could locate where the issue was with your scripts. And it’s never a bother for us, so please don’t worry. We all miss things, me for one, and we are happy to help. As we the saying goes, four eyes see more than two
Have a nice rest of Friday and enjoy the weekend ahead!