Ask a Question

Change Value with a variable in a Mock Response

sc_paca
New Contributor

Change Value with a variable in a Mock Response

Hi,

In a project, there is a mock service and there is a mock response. Inside there is a tag: <local_OrderId>9999</local_OrderId>

I want to know if it's possible to change the value of this tag by groovy. How to change this value by a variable? Like this the value of the tag will be able to take different value and not only 9999.

In a test case I can change in SOAP Test request the value ${Properties#QuoteID} of the request but I don't know how to change in the mock response.

Thanks for your help

SC

 

2 REPLIES 2
nmrao
Community Hero

Re: Change Value with a variable in a Mock Response

sc_paca
New Contributor

Re: Change Value with a variable in a Mock Response

Hi nmrao,

 

In my case I want to affect a custom properties (of the test case) to the value ${Order1} of the mock response of the <local_OrderId>${Order1}</local_OrderId>.

if in the script of the mock response I set this line:

requestContext.Order1 = 1001

the value 1001 is applied to ${Order1}.

But now I want to replace 1001 by the custom properties of my test case to change by more than one value (import txt file).

your solution help me but it's not enough.

 

BR

SC

cancel
Showing results for 
Search instead for 
Did you mean: