Service Virtualization

  • 1.  Passing values between two transactions

    Posted Apr 24, 2018 07:54 AM

    Hi Team, 

     

    I have one virtual service with more transactions(Different operations).

     

    I need to capture the value of an incoming argument from one operation and be able to use this as a value for one of the tags in the response of another operation which is present in the same virtual service. 

     

    How can I achieve this?



  • 2.  Re: Passing values between two transactions

    Posted Jun 02, 2018 05:00 PM

    Hi Dhansekar,

     

    Your question is not clear . 

    What i understood is 

    - You have a service with multiple operation 

    - Argument is to be fetched when request is recieved on operation say A

    - Using the same argument proeprty in response to another request for different operation say B 

     

    Am i right ?



  • 3.  Re: Passing values between two transactions

    Posted Jun 04, 2018 08:15 AM

    Yes Rahul. 

     

    Your understanding is correct. Could you please advice how to achieve it. 



  • 4.  Re: Passing values between two transactions
    Best Answer

    Broadcom Employee
    Posted Jun 04, 2018 08:32 AM

    There are different ways of accomplishing this, depending on whether you're in a conversational transaction, whether you want to share values in multiple sessions, whether you want to enable tests to use the same values as virtual services, etc. Take a look at this blog entry for examples:

    So you want to keep count in a virtual service? 



  • 5.  Re: Passing values between two transactions

    Posted Jun 04, 2018 03:54 PM

    Hi Dhanesekar,

     

    Approach 1:

    The easiest and efficeint way is using SharedModelMap Java class . Class exposes Put (To create key:Value Pair) Method and Get Method to retrieve the same property .Follow Below Steps:

    -  Add Dynamic java Execution Step and load object of class com.itko.lisa.vse.SharedModelMap 

    - Call Put method and created a named property to store value 

     

    Similarly as above create one more step by calling Get Method of same class to get the property value .

     

    Try doing this in a test case . Create two test case one for creating property (PUT) and another for fetching property . 

     

    Approach 2: 

    Use a table to store proeprty value whcih you can fetch anytime and use as property in any response. 

    But this is not a good way because it will increase execution time for Insert/Fetch.