Hi,
New k6 user here.
I have used postman-to-k6 project to convert some postman tests into k6. Everthing has been nice after some fixes but now I have a little problem generating new users.
The very first thing that my current testing collection does is register a new user and the way we generate the name is using Date.now(). We do something like “user_”+Data.now()+“@XXXXX.com”.
I have set the VU’s to 2 just for the sake of testing and Date.now() is returning same miliseconds for each VU, so, one of my users can’t register because that email already exists.
I think this could be fixed if I could get the time in microseconds. Is this possible with k6?
On the other hand if there exist a way to delay the execution of the new iterations by some mili/seconds that would fix my problem too. Is this even possible?
I have used sleep to try to pause before building the email but again (and this is a bit odd) Date.now() is retrieving same time stamp.
Right now I’m using something like this for the register request:
pre() {
console.log("=========> Waiting");
sleep(1);
console.log("=========> Time: "+Date.now()); --> This prints same time stamp for the 2 vu's
},
Thanks in advance.