Service Virtualization

  • 1.  filters and assertions based on conditions

    Posted Aug 06, 2017 12:21 PM

    I have a requirement like below :

     

    "device": "357752071933886",
    "deviceEligiblity": {
    "deviceStatus": "Eligible",
    }
    "device": "357752071934321",
    "deviceEligiblity": {
    "deviceStatus": "In-Eligible",
    }

    I have to use the device value from one service response and use it in subsequent test step only if deviceStatus is of value eligible . We can have an assertion to check whether deviceStatus is eligible and then only the filter for taking device value should be used . Not sure how to achieve this . Pls suggest on the solution for this requirement



  • 2.  Re: filters and assertions based on conditions

    Posted Aug 07, 2017 09:51 AM

    Hi Rajeswari, 

     

    Thank you for posting on the community page. I see a 'Category' is not chosen. Can you please specify which product you are working with for this question? 

     

     

    Best regards,

    Taylor



  • 3.  Re: filters and assertions based on conditions

    Posted Aug 08, 2017 08:59 AM

    There is not enough information for us to provide a concrete example. One thought would be to see if you can use the VSI Operation and Arguments to manage the responses.  

     

    Is the second call to the service performed using a different operation or the same operation?

     

    1st Call:

    Operation 1 for Device 357752071933886 responds with Eligible.

    Operation 1 for Device 357752071934321 responds with In-Eligible.

    OR

    Operation 1 response contains both Devices 357752071933886, Eligible and Device 357752071934321 In-Eligible. 

     

    2nd Call:

    Consumer App chooses one of the above Device #s and makes a call using Operation 2. (Assumption: the Device # is in the request).

    |-- Operation --| --------  Argument  -----------------|

    Operation 2, input Device # = 357752071933886, VSI response = response for Eligible data.

    Operation 2, input Device # = 357752071934321, VSI response = response for In-Eligible data.

    In this example, a given Device # is either eligible or not every time. The approach attaches the desired response to the Device Number. Perhaps, the META transaction always responds with Device = Eligible and specific transactions control or identify only the Devices that are In-Eligible. Additional controls on the actual response could be implemented in the VSI or the VSM.



  • 4.  Re: filters and assertions based on conditions
    Best Answer

    Posted Aug 10, 2017 04:53 PM

    I would have achieved this by using 'do Nothing Step'. 

    Step 1:  You can assert deviceStatus for value 'Eligible'. If true move to Step 2.

    Step 2: Do Nothing Step, use a filter to extract device value from the last step response.

       [Hint]: Use lisa.{{lastStepName}}.rsp as the property.

    Step 3: Step to use device value.

     

    Let me know if you need more details around it.

     

    Thanks,

    Monika



  • 5.  Re: filters and assertions based on conditions

    Posted Dec 01, 2017 05:03 AM

    Thanks monika. Below is my requirement :

     

    In the below json response , only when inventoryStatus is InStock , i have to take the SKU value using the filter to the next step . The below structure will repeat in the response . I did not get how the above mentioned steps will work for this scenario. Pls clarify more in detail.

     

    {
    "replacementDeviceList": {
    "replacementDevice": [
    {
    "exchangeSKU": "XSAMT923TBLK",
    "AStockSKU": "610214642486",
    "priority": "1",
    "displayOnUI": true,
    "productName": "SAM T817T TAB S2 BLK EXCH",
    "inventoryStatus": "BackOrdered",
    "estimatedShipmentDateFrom": "2017-12-01",
    "estimatedShipmentDateTo": "2017-12-06"

    },
    {
    "exchangeSKU": "XAPP817TBLK",
    "AStockSKU": "610214641755",
    "priority": "1",
    "displayOnUI": true,
    "productName": "App iphone i7",
    "inventoryStatus": "InStock",
    "estimatedShipmentDateFrom": "2017-12-01",
    "estimatedShipmentDateTo": "2017-12-06"
    }
    ]
    }
    }