Service Virtualization

 View Only
  • 1.  better option to return same response to multiple requests in same image

    Posted Mar 01, 2019 01:46 PM

    I have doubts about the better option to, in dinamically selection of a image in same vsm using assertions, if I use a vsi to specify error responses if the condition specified for the aassertion doesn't matches, for example, if the first assertion matches run the first vsi, if the second assertion matches run the second vsi, and if both assertions doesn't match run a vsi with error responses for all request in the vsi, and if some of the request should return the same response (same http code and body), ¿how is the most efficent form to implement this?

  • 2.  Re: better option to return same response to multiple requests in same image

    Posted Mar 15, 2019 01:51 PM

    It is possible to have multiple VSI selection steps in a VSM; however, I am not certain why you could not have a single VSI handle the selection of different responses.  


    Can you describe more about the assertions and why this leads to the need for multiple VSIs?

    What are you asserting on to determine which VSI to send the request to?


    If the properties that are being asserted exist in request argument list, the VSI should be able to handle the selection for you by examining the argument and utilizing the 'comparison operator' and 'value' assignments.

    Using the above as an example, the VSI have different responses based on:

    If color = "blue", send response 1

    if color starts with the letter "g" (using Regex), send response 2

    if color is red or yellow or purple (using Regex), send response 3

    META sends an error response indicating that none of the above specific transactions were matched.


    There is also another approach called a Match Script that provides the ability to add your own custom comparison logic. 

  • 3.  Re: better option to return same response to multiple requests in same image

    Posted Apr 15, 2019 04:58 AM

    For example, I developed a SV, with multiple transactions, but one of this, the first, needs create a random identifier, and only in this case is needed the creation of the identifier, and using assertions I can select a vsi with only this case with the step to create the identifier, and other vsi with the rest transactions, this is ok.

    But after appeared another approach, If some conditions are applied (for any transaction), I need return a 401 error, the same response for all transactions, and I created another vsi for the error cases responses, and I'm thinking in the correct mechanism or procedure to define a vsi with only transaction (shared for all) and the response for all transactions if the conditions are applied, avoiding have x responses equals and needing change all if a modification is needed, for example.