1
votes

I need to generate a new sequence number in SOAPUI request as a parameter while executing load test. I wrote a groovy script for that and added it as a test step. But problem arises when I set number of Threads more than one. In that case, a new sequence number doesn't get generated for every request since multiple threads are executing and same sequence number gets repeated in multiple request. Can somebody suggest any solution or workaround to deal with this situation. P.S. I do not have SOAPUI PRO so that I can use DataGen.

1
If you just need the numbers to be unique, and not necessarily sequential, you can assign a significantly different offset to separate threads (so thread 1 will have numbers 1, 2, 3 etc, thread 2 will have 1001, 1002, 1003 etc. Obviously won't work if the numbers actually need to be sequential, though. - CptBartender
Thanks for your response @CptBartender but that is not practically possible for me. In my case, number of Threads can be upto 1000 and all generated sequence number should be a 3 digit number like 000,001,002... Anyways, could you please let me know how can we set the offset for all the threads in SOAPUI? Thanks! - Akhil Tiwari
@AkhilTiwari This may be your issue too. - user1207289
@user1207289 Thanks but not exactly actually. In the threads you referred, if I read those correctly, expectation is to have separate context for all the threads. My problem is: I want all the threads to use same copy of the variable so that I can get a different (incremented) value of that variable for all the threads. Since execution of all the threads start at same time, value of that variable does not come out to be different in every case. In short, all I need is a unique sequence number inside a SOAP request parameter which is executed by a number of threads running in parallel. - Akhil Tiwari

1 Answers

0
votes

If you just want a unique number in SOAP request parameter, everytime it runs, use this directly inside parameter.

${=((long) Math.floor(Math.random() * 90000000L) + 10000000L)}