how can I give a variable in my load test,
I have Soap request which I will be using in LoadTest
But the problem is LoadTest will run the same query again n again in the loop
I want the loadtest to have a variable assigned, so the variable should take the value from the defined range ..
Example:
Below is my SOAP request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.apertio.com/webservice/TmoUsEIRSoap/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:DeviceQueryReq>
<transactionId>12345</transactionId>
<vendorId>29</vendorId>
<userEquipmentInfoType>imeisv</userEquipmentInfoType>
<userEquipmentInfoData>444999334567890</userEquipmentInfoData>
</v1:DeviceQueryReq>
</soapenv:Body>
</soapenv:Envelope>
In the above request, I want to give "userEquipmentInfoData" input as a variable
Something like
<userEquipmentInfoData>"$IMEI"</userEquipmentInfoData>
where IMEI=444999334560000-444999334570000
So that the loadTest will run take the values from this range when it run each time.
Hi,
So to generate a random number every time (with the same number of digits that you have in your example) you can use:
${= ((String)(int)(Math.random()*10000000000000)).padLeft(14,'0')}
This would generate something like:
00002147483647
Breaking the one-liner down:
(int)(Math.random()*10000000000000) //generates a random integer >0 and <10000000000000
Then, to get the right number of digits every time, I padded the number with zeros from the left:
.padLeft(14,'0')
Will this do?
Regards,
Rup