Service Virtualization

  • 1.  DevTest 9.1.0-Ignore META match and point to Live system

    Posted Aug 03, 2016 03:49 AM

    Hello Everyone,

     

    Could you please help me with the problem below.??

     

    I have created a image which matches few incoming requests. If there is no match with the incoming request, the image responds with META response- which is the expected thing to do, as far as the signature matches.

     

    I want a solution, which ignores the META match in the above case and points to the live system instead. Basically, I need the image to respond only if there is an exact match with the incoming request, else point to Live system.

     

    Is there a way to accomplish this?.. Please help me out..

     

    Thanks,

    Senthil Manohar



  • 2.  Re: DevTest 9.1.0-Ignore META match and point to Live system
    Best Answer

    Posted Aug 03, 2016 08:32 AM

    Hi Senthil, as with most solutions, there are multiple ways to handle this.

     

    Option 1:

    - In the VSI, replace the response with the text "404" without the comments (or use what ever you want).   Also, you might consider making the same change in the Stateless Image Response to enable a technique where operations and signatures that do not match also branch to the Live Invocation step.

     

    - In the VS Image Selection Step in the VSM, add a Scripted Assertion:

    if ("404".equals( lisa_vse_response.get(0).getBodyAsString() ) )

        return true;

    else

        return false;

    Set the Assertion to branch to the Live Invocation Step if the Assertion returns true.  If false, the VSM moves to the next step which is most likely the Responder Step.

     

    (you might also be able to use an ensure property contains with Regex for your value)

     

    Option 2:

    I have seen some folks add a property to the Response's META data on the response and check it to determine if branching live or sending a virtual response.  I prefer adding the value in the VSI response because it is easier for developers to spot.  We don't tend to look at the response Meta data that often.

     

    Option 3:

    There may be a property that can be evaluated (for example, something like lisa vse transaction matched) that indicates a transaction was not found.  I have never looked really hard for something like this.

    Good luck.



  • 3.  Re: DevTest 9.1.0-Ignore META match and point to Live system

    Posted Aug 03, 2016 09:30 AM

    Hi Joel,

     

    Thanks for your inputs... your approaches are very useful...