How to modify a response and send it back as request in the next step

Document ID:  TEC1723898
Last Modified Date:  07/25/2017
{{active ? 'Hide' : 'Show'}} Technical Document Details

Products

  • CA Service Virtualization

Releases

  • CA Service Virtualization:Release:10.0
  • CA Service Virtualization:Release:10.1.0
  • CA Service Virtualization:Release:7.1
  • CA Service Virtualization:Release:7.5.0
  • CA Service Virtualization:Release:7.5.1
  • CA Service Virtualization:Release:7.5.2
  • CA Service Virtualization:Release:8.1
  • CA Service Virtualization:Release:8.0.1
  • CA Service Virtualization:Release:8.0.2
  • CA Service Virtualization:Release:8.0.0
  • CA Service Virtualization:Release:8.2
  • CA Service Virtualization:Release:8.3
  • CA Service Virtualization:Release:8.4
  • CA Service Virtualization:Release:8.5
  • CA Service Virtualization:Release:9.1
  • CA Service Virtualization:Release:9.0
  • CA Service Virtualization:Release:9.5
  • CA Service Virtualization:Release:9.5.1

Components

  • CA ITKO LISA TEST / FRAME:ITKOTF
Question:

I need to store a JSON response in a property and change a certain value in the response property and pass it as a request to the next REST step.

How can I automate this process with DevTest?

Environment:
All Supported DevTest Releases.
Answer:

Here is an example if the response has always the same structure and we want to modify one specific field of this response.

1. Have the value you want to update in the response saved in a property or get the value from a data set.

In the example below, I am using the data set, "Random Code Generator", to generate a random value and I am saving this value to the property "newPrprty".

 

 

Test Case Random Data Set Example

 

2. Add an "Output Log Message" step after the REST step that receives the response you want to modify.

 

3. Copy the response from the REST step to the new "Output Log Message" step and modify the field you want to update with the property saved in the step #1 – {{newPrprty}}.

 

Test Case Output Log Message Step

 

4. In the REST step, that will send the updated response as the request, place the "Output Log Message" step response as the request body – {{lisa.Output Log Message.rsp}}.

 

Test Case New Rest Step

 

5. Save the modified Test Case.

 

When you run the test in the ITR you can see the new property being set in the first step:

 

ITR Results DataSet

 

The static response being updated in the "Output Log Message" step:

 

ITR Output Log Message Step

 

The response of the "Output Log Message" step being sent as the request body in the REST step:

 

ITR Updated Request

 

Additional Information:

For more information regarding "Random Code Generator" data set: Random Code Generator Data Set.

For more information regarding "Output Log Message" step: Output Log Message.

Please help us improve!

Will this information enable you to resolve your issue?

Please tell us what we can do better.

{{feedbackText.length ? feedbackText.length : '0'}}/255

{{status}}

Not what you were looking for?

Search Again >

Product Information

Support by Product >

Communities

Join a Community >