Make a request in loop and set delay

Hello guys,

Is it possible to make a request in loop and somehow set delay? I mean, I have a request which deletes some messages and where it will clear, I want to wait like 1-2 minutes and then make same request. Do you have any ideas how it should be done ?


the question is - why? Is your API really so slow? Why not to use a kind of explicit wait, for example send delete request and then call GET in a loop until 404 is returned - now you are sure that the object was deleted and you can send DELETE request again to verify invalid input handling.

I am working with ActiveMQ Artemis. The Queue fills very fast and for that I need to remove messages. When I remove messages, I have to wait 1-2 minutes and do that again to clear next came messages.

So - if I get it correctly - you want to run a background task regularly to do some routine (deleting messages from quue) every 2-3 minutes. I think you are looking for cron job or any kind of cloud service which can do this (Azure Scheduler or so).

You can do this in Katalon, but it seems to be a quite overhead for me. I think there are more suitable solutions.

1 Like

Yes you are right. Now I use jmeter for that, it is more comfortable to do such things. Well I also managed to make it in Katalon, but if I execute it, I should not be able to execute different cases.
I used sleep method for that, when I sent every request i made a sleep for 2 minutes and then after 2 minutes it starts loop again.

Sleep is the worst thing you can do. You are constantly blocking one thread to perform 100ms operation once a time. Use Task Scheduler (Windows) or crontab (Unix), you can even call Katalon test case/suite which contains only this job, but never use sleep for such purposes.


Thanks Marek for your advice, I will take it in mind :slight_smile: