Forum Discussion

sanjivacharyya's avatar
14 years ago

How to generate sequence number in SOAP UI load testing

Hi All,

I am executing load test from SOAPUI for a web service API.
The API is expecting a 11 digit number and other parameters. I want that number to be increment by 1 for every requests.
Below is the request details:-

Request XML:-
.....
.....
<mobileInfo>
<mdn>${create-subs-mdn#result}</mdn>
</mobileInfo>
....
...
And Groovy script is (create-subs-mdn) :-

def showRandomInteger( aStart, range, aRandom){
long fraction = (long)(range * aRandom.nextDouble());
long randomNumber = (long)(fraction + aStart);
log.info("Fraction : " + fraction);
return randomNumber;
}

def range = 1000
def startMDN = 91988000022
Random r = new Random();
valueFromFile = showRandomInteger(startMDN,range,r);
log.info(valueFromFile);
return valueFromFile


Using above, I am able to generate a random number for every requests but this is not solving my problem.
I want the script to return 1 incremented value for each requests.
Like, first request will get 91988000022, second request 91988000023, third 91988000024 and so on....

Please help me to do this

Thanks in advance.
Sanjiv

1 Reply

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Apparently you can't use the Number type in the DataGen step for 11-digit numbers, but you can try this:

    1) Create a property where you set your starting number (eg, 90000000000)
    2) Add a DataGen step and create a Number type property that runs from 0 to at least the number of requests you will submit during the run. Make sure to check 'Shared' so that each thread will get a unique number.
    3) Add a Script property in the same DataGen step that returns the start number property added to the Number type property. Mark this 'Shared' as well, and use this new property in your request.