Service Virtualization

Expand all | Collapse all

Match Script, enriching VSE response

Jump to Best Answer
  • 1.  Match Script, enriching VSE response

    Posted 06-06-2017 06:50 AM

    Hi All,

     

    I want to write a match script which compares a parameter of the incomingRequest(the request that client will be sending) with some parametrized {{value}} in the configs-file and based on that it should enrich some fields of the response(which again I have stored in the configs-file).

     

    For eg.

    sourceRequest-

    key: country;

    value: {{value stored in configs file, say, India}};

    state: abc;

     

    incomingRequest-

    key: country;

    value: India;

    state: xyz;

     

    Now, I want the script to compare the "value" of my incomingRequest with the "value" of my sourceRequest and populate my response fields with corresponding values from configs-file.

     

    For this I will need to create some kind of flag property as I have multiple responses, so, is it possible to do that in LISA.

     

    OR

     

    Instead of taking data from the configs file I can make different responses and keep those responses in my Data folder, but then I will need a script which will pick up a response from that data folder corresponding to unique incomingRequest. Is this possible to do. If yes. How?

     

     

    Please help.



  • 2.  Re: Match Script, enriching VSE response
    Best Answer

    Posted 06-06-2017 09:21 AM

    Hi ShubhamArya,

     

    You can add a scriptable data protocol on the listen step , do the required comparisons and based on the result add a new parameter to the request.

    Once the request is directed to the image, you can compare on this newly added argument and send appropriate response.

     

    you may refer to the following for info on scriptable data protocol,

     

     https://docops.ca.com/devtest-solutions/10-1/en/using/using-ca-service-virtualization/using-devtest-workstation-with-ca-service-virtualization/creating-service-images/using-data-protocols/scriptable-data-protocol

     

    Hope this helps,

    Venkatesh Satturi