Service Virtualization

  • 1.  Save the response from service virtualization

    Posted Oct 31, 2017 05:13 PM

    Hi,

     

    I am new to CA Dev test. I have created a VSI and VSM. I have a service with path "/airfare" which when requested returns all the air fares. I need to store the request coming to CA virtual server and also the response for later use. Once saved I need to query the saved responses based on an input. Will that be possible using CA Devtest?



  • 2.  Re: Save the response from service virtualization
    Best Answer

    Posted Nov 01, 2017 08:00 AM

    Hi, 

     

    Yes this is possible in Dev Test. 

    you can apply filter (Save Property value to file) on VSM step (VS Image Response Selection) 

     

    PropertyName in Dev Test 

    For Request - lisa.vse.request

    For Response - lisa.vse.response

     

     

     

     

     

    Thanks ,

    Vinay Nagariya



  • 3.  Re: Save the response from service virtualization

    Posted Nov 01, 2017 02:17 PM

    I created the filter and when I ran the test, nothing is stored. Or thinking otherwise after I created the filter and when I ran Run Filter I am getting 

    No response exists for this step, so we cannot run this filter. Please execute this step first, or select an existing property from the combo box that you want to run the filter on.

    Please let know what should I do. My requirement is to store request and response from the VSM when there happens a transaction on that deployed vsm.



  • 4.  Re: Save the response from service virtualization

    Broadcom Employee
    Posted Nov 02, 2017 10:28 AM

    Hi, Request is available in the property "lisa.vse.http.current.transaction.body" and lisa.vse.response is in Transient form and that is why you are not getting it.

     

    You can use the below code in a Scripted Assertion in VS Image Response Selection step and store the response into a property and use it later.

     

    import com.itko.lisa.vse.stateful.model.TransientResponse;

     

    responseList = testExec.getStateObject("lisa.vse.response");
    TransientResponse response = responseList.get(0);
    String respText = testExec.parseInState(response.getBodyText());
    testExec.setStateValue("VsRsp",respText);

    return true;

     

    Hope the above information will help you.

     

    Thanks,

    Prema



  • 5.  Re: Save the response from service virtualization

    Posted Nov 08, 2017 08:17 AM

    Hi,

    Did as you suggested in Response Selection step:

    and added a Filter in VirtualService Tracking step to log the response in a file:

    however, the scripted assertion seems not called when looking at the event in Inspection view.

    I guess the if tracking assertion should go to the scripted assertion but cannot manage it from the assertion menu.

    Thanks 



  • 6.  Re: Save the response from service virtualization

    Posted Jan 18, 2018 06:26 PM

    use the below in scripted assertion:

     

    String parsedValue = testExec.parseInState( lisa_vse_response.get(0).getBodyAsString() ) ;