I had to send two xml messages to a JMS queue with slight delay between them. Since I am writing a Java Vuser script, I wasted no time in choosing Thread.sleep( milli sec) function. This worked fine in Vugen so I was sure. But during the execution of Scenario in Load Controller, I observed that the expected output of the transaction is broken and the transaction is failed.

Upon investigation I found that the two messages are not going to the queue in the order we expected. The second message is going early causing the transaction to fail. This is because the Controller is NOT inducing the delay I mentioned in Thread.sleep function. So the correct function to use is lr.think_time(sec). This function causes the Controller to actually wait for the specified number of seconds.

Just this 1 line of code resulted in wastage of 2 person days! But again, this can be learned only by experience.

Leave a Reply

Posted in:


%d bloggers like this: