Service Virtualization

  • 1.  How to fetch Assertion Description Error ?

    Posted Jun 17, 2016 12:58 AM

    Hi Folks,

     

    I need to fetch assertion's error description (Long Info field) for informational purpose in my test case. I can see that its not set by default in any properties so that I can fetch from there .

     

    Please help ASAP.

     

    In Example Below: I need to fetch parse error when assertion is fired.

     

    assrtn.PNG

     

    TIA

    Rahul V



  • 2.  Re: How to fetch Assertion Description Error ?

    Posted Jun 25, 2016 05:03 PM

    Hi , Any one has got suggestion for this step please ? , it would be easy when we capture the asset error and sent in fault description while respond back in soap response to client



  • 3.  Re: How to fetch Assertion Description Error ?

    Posted Jun 28, 2016 06:52 PM

    J_NeSmith : Hi Joel , just checking if you have got any hints for this query.. thanks for your time



  • 4.  Re: How to fetch Assertion Description Error ?
    Best Answer

    Posted Jun 29, 2016 01:10 AM

    Hi User,

     

    I have used Custom listener for this using Assert Event . Whenever Assert event will be fired long description will be captured in Property Specified. Custom listener should be at the start of script (can be first step as well such that listener is active whenever assert even is fired).

     

    Code Snippet - Custom listener

     

    var custom_listener = new com.itko.lisa.test.TestEventListener(){
    public void testEvent(com.itko.lisa.test.TestEvent testevent){
      if(testevent.getEventId() == com.itko.lisa.test.TestEvent.EVENT_ASSERT){
       testExec.setStateValue("EventResponse",testevent.getLongDesc());  //event response property will store the long description(error) in assert event
      }
    }
    };

    testExec.setStateValue("Custom_Listener",custom_listener); //Stores a referens to the eventlistener so we can later remove it

    testExec.getTestEventMgr().addListener(custom_listener,com.itko.lisa.test.TestEvent.noFilter); //Add the listener to the testcase

     

    Please find below script implemented: Here I am capturing Parse error long info assertion description for ensure XML validation Assertion.

    EventResponse Property highlighted below.

     

     

     

     

    Regards

    Rahul V



  • 5.  Re: How to fetch Assertion Description Error ?

    Posted Jul 14, 2016 03:21 PM

    Thanks Rahul3183

    just got chance to try your suggestion..:)

    I am trying to capture this in VSM steps.. I guess you have implemented this in lisa test .. is this still works in VSM also ? i thought these properties or JS script your shared is for lisa test case steps.



  • 6.  Re: How to fetch Assertion Description Error ?

    Posted Jul 18, 2016 05:03 PM

    yes User. It works in vsm as well.



  • 7.  Re: How to fetch Assertion Description Error ?

    Posted Jul 19, 2016 06:08 PM

    monika_mehta

    cool.. I am trying to implement this after the response lookup step.. once response is selected I am trying to add another step with xml validation filter and check if the response is valid or not.. so do you think i have to add the above listener  before inserting xml validation step..



  • 8.  Re: How to fetch Assertion Description Error ?

    Broadcom Employee
    Posted Jul 19, 2016 07:43 PM

    Yes, you will need this to added before the xml validation step.

     

    Make sure you check Custom_Listener is not present in testExec before adding the custom code.



  • 9.  Re: How to fetch Assertion Description Error ?

    Posted Jul 21, 2016 07:00 AM

    Yes...You need to add that.

    Even I am validating both request as well response.

    Custom Listener will capture assertion events of each and every assertion in your VSM.

     

    Just go through ITR once you can see that whenever any assertion is fired "EventResponse" Property value will be changed (Overwritten).

     

     

     

    Listener will capture every assertion fired. To preserve any value better you can copy that to different property to retain it