Changing a value of project/test case property within REST Test Step
Hi,
Is it possible to change value of project/test case property within REST Test Step?
For example:
Custom property “MsgId” with certain initial value defined for SoapUI project.
This property can be used a number of times within a body of a REST request for separate (sub-) requests and its value for each (sub-)request should be unique.
Simplified example of the REST request body:
<ReqSet>
<Request1 MsgId=”${#Project#MsgId}” ... />
<Request2 MsgId=”. . .” ... /> <!-- How to change value of MsgId for the Request2? -->
<Request3 MsgId=”. . .” ... /> <!-- How to change value of MsgId for the Request3? -->
. . .
</ReqSet>
Note that request 2 and request 3 are not different REST requests, but a part of the same REST request.
Any help would be much appreciated.
Thanks
Yes, you can retrieve the property value and then modify it, please see the following code:
<request1>${#TestCase#i}${=testCase.setPropertyValue("i", String.valueOf(Integer.parseInt(testCase.getPropertyValue("i")) + 1))}<request1> <request2>${#TestCase#i}${=testCase.setPropertyValue("i", String.valueOf(Integer.parseInt(testCase.getPropertyValue("i")) + 1))}</request2>
Karel