Service Virtualization

  • 1.  CA Lisa 7.5.2: How to respond with recorded response for an incoming request?

    Posted Apr 21, 2016 10:05 AM

    Hi Experts,

    I want to handle a scenario, where my system fails when run against the Virtual Service. Please help me resolve this.

     

    I have recorded an incoming request as below using the live traffic:

    Operation Name: UpdateCustomer()

    UpdateCustomer_Profile_RequestItem_AccountNumber:{}

    UpdateCustomer_Profile_RequestItem_AccountName:{}

    UpdateCustomer_Profile_RequestItem_CurrentPlan_Internet:{}

    UpdateCustomer_Profile_RequestItem_CurrentPlan_HomePhone:{}

    UpdateCustomer_Profile_RequestItem_CurrentTarrif_Internet:{}

    UpdateCustomer_Profile_RequestItem_CurrentTarrif_HomePhone:{}

    UpdateCustomer_Profile_RequestItem_NewPlan_Internet:{}

    UpdateCustomer_Profile_RequestItem_NewPlan_HomePhone:{}

    UpdateCustomer_Profile_RequestItem_NewTarrif_Internet:{}

    UpdateCustomer_Profile_RequestItem_NewTarrif_HomePhone:{}

     

    I have a response recorded for the above request in the VSI. While play back, the image is matched if the exact scenario is repeated, irrespective of test data. But the image is not matched when the scenario is slightly modified.

    For example, if the incoming request is like below (few more arguments added to the incoming request), the matching fails, resulting in an error. (I can do an operation match to make it pass, but that's not the expected scenario)

    Operation Name: UpdateCustomer()

    UpdateCustomer_Profile_RequestItem_AccountNumber:{}

    UpdateCustomer_Profile_RequestItem_AccountName:{}

    UpdateCustomer_Profile_RequestItem_CurrentPlan_Internet:{}

    UpdateCustomer_Profile_RequestItem_CurrentPlan_MobilePhone:{}

    UpdateCustomer_Profile_RequestItem_CurrentPlan_HomePhone:{}

    UpdateCustomer_Profile_RequestItem_CurrentPlan_HomeTV:{}

    UpdateCustomer_Profile_RequestItem_CurrentTarrif_Internet:{}

    UpdateCustomer_Profile_RequestItem_CurrentTarrif_MobilePhone:{}

    UpdateCustomer_Profile_RequestItem_CurrentTarrif_HomePhone:{}

    UpdateCustomer_Profile_RequestItem_CurrentTarrif_HomeTV:{}

    UpdateCustomer_Profile_RequestItem_NewPlan_Internet:{}

    UpdateCustomer_Profile_RequestItem_NewtPlan_MobilePhone:{}

    UpdateCustomer_Profile_RequestItem_NewPlan_HomePhone:{}

    UpdateCustomer_Profile_RequestItem_NewPlan_HomeTV:{}

    UpdateCustomer_Profile_RequestItem_NewTarrif_Internet:{}

    UpdateCustomer_Profile_RequestItem_NewTarrif_MobilePhone:{}

    UpdateCustomer_Profile_RequestItem_NewTarrif_HomePhone:{}

    UpdateCustomer_Profile_RequestItem_NewTarrif_HomeTV:{}

     

    Please help me handle this kind of a dynamic incoming request scenario. what's the best approach for this? I think of writing a match script to throw the recorded response irrespective of the incoming request, provided the operation name matches. But I have no idea how to write a match script for this.

     

    Is there any other inbuilt functionality to handle this? Please suggest.

     

    Thanks,

    Senthi



  • 2.  Re: CA Lisa 7.5.2: How to respond with recorded response for an incoming request?

    Posted Apr 21, 2016 03:57 PM

    Hello Senthi,

     

                  If you have certain key fields that you would like to match for, instead of operation level match, you can write a match script to perform the match in beanshell as given below.

    String incomingValue = incomingRequest.getArguments().get("SomeParameterName");

    if(incomingValue.equalsIgnoreCase("Value to be matched")) {

        // true means these arguments match

        return true;

      }

    }

    // false means no match

    return false;

     

    Thanks,

    Surya.



  • 3.  Re: CA Lisa 7.5.2: How to respond with recorded response for an incoming request?

    Posted Apr 22, 2016 03:22 AM

    Hi Surya... Thanks for your response..

    The case explained by you works if we need to match based on parameter names.. But my expectation is different..

     

    I have a recorded request (Req1) along with the corresponding response (Res1).

    While play back, if I pass the same Req1 (parameter values can be different), the image is matched and is responded with Res1.

     

    But I want to handle a scenario like this:- If I pass Req2 (same operation, but the no of arguments in the request varies), the VS is responding with no image match because of the difference in no of arguments. I want to write a match script to read the incoming request (Req2, Req3 etc) and count the arguments and respond back with the recorded response (Res1).

     

    Can you suggest something for the above scenario?

     

    Thanks,

    Senthil



  • 4.  Re: CA Lisa 7.5.2: How to respond with recorded response for an incoming request?

    Posted Apr 22, 2016 08:14 AM

    Hi Senthil,

     

    Change the match style to operation and redeploy the service. That should work!! irrespective of what the signature of the request you are sending, as long as the operation name is matched, your recorded response (res1) will be picked.

    Hope it helps!!

     

    Regards,

    Shivakumar.



  • 5.  Re: CA Lisa 7.5.2: How to respond with recorded response for an incoming request?

    Posted Apr 22, 2016 09:08 AM

    Hi Shivakumar.. thanks for your response..

    but my requirement will not be met, just with operation match style.

     

    As I explained in my first post, I need to handle the incoming request and throw back the recorded response. This could be done only with match script (this is my assumption) and If you could help me in that, it would be great.

     

    Thanks,

    Senthil



  • 6.  Re: CA Lisa 7.5.2: How to respond with recorded response for an incoming request?
    Best Answer

    Broadcom Employee
    Posted Apr 22, 2016 09:32 AM

    In the second case, is the response different because of the added mobilePhone and homeTV arguments in the request?

     

    If yes, simply record that specific transaction and merge it into your original.

    If no, you want to add Request Data Manager DPH during your recording session, and KEEP the core arguments. Because you've used KEEP, any additional arguments will be invisibly discarded by DevTest, and your exact / meta match will work as intended.

     

    Rick



  • 7.  Re: CA Lisa 7.5.2: How to respond with recorded response for an incoming request?

    Posted Apr 22, 2016 09:42 AM

    Hi Rick..thanks for your response... I will try your suggestion and post my findings soon..

    regards,

    Senthil



  • 8.  Re: CA Lisa 7.5.2: How to respond with recorded response for an incoming request?

    Posted May 04, 2016 03:02 PM

    Hi SenthilMano,

     

    Did Rick's suggestion work? Please be sure to update the community on whether this solution worked for you or not!

     

    Thanks,

    Melanie