We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
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>
Use "substring" method to get the required value.
For example:
def s = 'N0382254'
log.info s.substring(5, s.size())
I'm using the below script..
def s = context.expand( '${CreateOrderNumber#result}' )
log.info s.substring(3, s.size());I'm getting the below error
java.lang.StringIndexOutOfBoundsException: String index out of range: -3
error at line: 2
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>