Displaying last 3 digits of a order number
Hi, I'm trying to test a test case where I have to pass the last three digits of an order number that I have created from another groovy script.
Below is my original script that creates the order number
int a = 9
nr = "N"
for(i = 0; i < 7; i++)
{
random = new Random()
randomInteger= random.nextInt(a)
nr = nr + randomInteger
}
//return nr
testRunner.testCase.setPropertyValue("OrderNumber",nr)
It creates an order Number for example N0382254.
Now in another script I want get the last three digits of that order number and save it into a property.
How can I call the original script and then get the last 3 digits?
Any help will be highly appreciated. Thanks!
Not sure why are you using like that while it can be done easily by:
Note that if you need to use that extracted value in a request, no addition groovy script is required. Instead use in-line script in the request itself as shown below:
<id>${= def id = testRunner.testCase.getPropertyValue("OrderNumber"); id.substring(5, id.size())}</id>