Is it possible for script to not loop?

NathanNathan Posts: 3
edited October 13, 2005 5:01AM in ANTS Load

I am sure somebody will have an answer to this question. We currently run ANTS load to great effect within our business but have found we want to use some of the scripts we've created to simply run a single time rather than to continuously loop for a set period. At the moment we are doing this by running the script for 1 minute, multiplied by the number of users we wish to load (often only 1).

Obviously as the script might run for less than 1 minute, this is not exactly a science. So if anybody could advise a way we could run a script with multiple users only for the duration of the recorded script it would be greatly appreciated. It will also allow my team to obtain greater accuracy when reporting the results.




  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello Nathan,

    If you want to get something to run exactly once, you can set up the test the way that you already have, with 1 virtual user running for one minute. To prevent it from possibly running again, you can try putting a one-minute sleep() command at the end of the script.

    To be even more exact, you can enclose all of the actions of the Run() method inside of in If/End If block that will not run if you set a variable in another class at the end of the first script run. There is a bit more detail in another post here: ... .php?t=954
  • Thank you very much for this information. We had already tried the method of adding the large sleep to the end which was working. The other option from the linked post does seem to provide a more technically clean option.

    In any case, this assistance is greatly appreciated.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    You're welcome!

    Coding the limit into the script is probably the cleanest way to go. It's a bit more work, though!
This discussion has been closed.