Service Virtualization

  • 1.  How to store all different assertion result in properties

    Posted Sep 09, 2017 04:40 PM

    I have to store or capture different assertion like 7 assertion on a single step and want to get the result store in some property so that at the end of the TC, I can verify it.

    Now we have only true or false options and goto step but in case of multiple assertion its complicated to proceed with goto next step as it will not execute the remaining assertions.

    I want to store it in a property that if all are true then only goto next step with saving them as a property for verification.

    Please reply as i need it urgently.

     

    Thanks,

    Naval



  • 2.  Re: How to store all different assertion result in properties

    Posted Sep 10, 2017 08:34 AM
      |   view attached

    One approach could be to set up an event listener and trap assertions when they fire.  

    In the attached Test Case,

    - the first step sets up a listener

    - the second step fires some assertions (using Generate Warning so that each assertion executes)

    - the third step removes the listener and prints out the trapped assertion's long and short descriptions.  

    Check and see if you can do something like this. The TC prints both the Long and Short description of the assertions that fire so you can see the difference in the output.

    If no assertions fire, the properties holding the descriptions would be empty. 

    Attachment(s)

    zip
    Event_Listener.tst.zip   1 KB 1 version


  • 3.  Re: How to store all different assertion result in properties

    Posted Sep 10, 2017 01:18 PM

    Hi,

    How to set a listener step as u mention in the example i understood the other part but not familiar with Listener step.

     

    Thanks,

    Naval



  • 4.  Re: How to store all different assertion result in properties

    Posted Sep 10, 2017 01:40 PM

    Hi,

    It will not work for multiple assertions can we have a solution for that to store all the assertion result in properties automatically so that we just have to compare instead of create filters for all 7 assertions.

    Thanks,

    Naval



  • 5.  Re: How to store all different assertion result in properties

    Broadcom Employee
    Posted Sep 10, 2017 08:48 AM

    I concur with Joel in case you need to get the assertion detail only if one of them fires. One thing to note is as per design in DevTest the moment of one assertions fire, none of the other following assertions would be reached. Besides you will not have the result of previous assertions (which didn't fire) either.

     

    The way your request is worded - it looks like you need to store results of certain checks on the response of a step. I feel you should be able to create appropriate filter/s to store the results of the checks you need to make & then have a assertion to check the values of the different filters.

     

    Please share your specific test case - (sample request/response & the details of 7 assertions) to see if what I suggested above is feasible.



  • 6.  Re: How to store all different assertion result in properties

    Posted Sep 10, 2017 01:38 PM

    Hi,

    Filters can store the properties but there must be a way to store all the assertion result in properties and then we can choose which one has the highest priorities and for the validation.

    Filters having separate approach and for multiple properties we have to create it manually which is more complicated and time consuming.



  • 7.  Re: How to store all different assertion result in properties
    Best Answer

    Broadcom Employee
    Posted Sep 10, 2017 01:42 PM

    We tried helping with the options that are present in the tool.

     

    If you need a customized solution - You will need to take up your request with DevTest product management



  • 8.  Re: How to store all different assertion result in properties

    Posted Sep 11, 2017 08:07 AM

    I use Warning as the assertion response, rather than Error or Fail, to allow each of the assertions (step 2) in the attached test case to fire.  

    The attached test case (step 1) uses the event listener to concatenate the response from each assertion that fires into a single property. The assertions that do not 'fire' are not trapped and appended into property.  

    Execute the example in ITR mode and it should work this way.

    There is no concept in DevTest of assigning priorities or ratings to assertions such that a Test Case fails if only 'n' or more assertions fire or some combination of assertions fire. This would be custom behavior and likely implemented in a custom routine.



  • 9.  Re: How to store all different assertion result in properties

    Posted Sep 11, 2017 02:30 PM

    Hi,

    You can apply below approach:

    Step 1- Store the values (true or false) in properties using filters.

    Step 2- Create a 'Scripted Assertion' , In this create your logic in any language Beanshell/Groovy/JavaScript/Velocity for writing the logic where you will return 'True' or 'false' as per your requirement.

     

    This is a workaround I use for such conditions. I hope it will solve your issue as well.

     

    Thanks,

    Dinesh Kumar