Service Virtualization

  • 1.  How to store results of Ensure XML validation assertion in devtest 9.5.1?

    Posted Nov 24, 2016 08:24 AM

    How to store results of Ensure XML validation assertion in devtest 9.5.1?



  • 2.  Re: How to store results of Ensure XML validation assertion in devtest 9.5.1?
    Best Answer

    Posted Nov 29, 2016 10:19 AM
      |   view attached

    See if you can try this approach.  The test case below shows the setup:

    The Setup Event Listener step is a JSR-223 step.  The code implemented by this step is shown below:

    import com.itko.lisa.test.TestEvent;
    import com.itko.lisa.test.TestEventListener;

    TestEventListener custom_listener = new TestEventListener() {
        public void testEvent(TestEvent testevent) {
            if ( testevent.getEventId() == TestEvent.EVENT_ASSERT ) {
            // tell what to do with the event.
            // In this case stores the long message in the flAssertMessage property
                testExec.setStateValue( "flAssertMessage", testevent.getLongDesc() );
                testExec.setStateValue( "flAssertEvent", testevent.getEvent() );
                testExec.setStateValue( "flAssertTestRun", testevent.getTestRun() );
            }
        }
    };

    testExec.setStateValue( "Custom_Listener", custom_listener );

    testExec.getTestEventMgr().addListener( custom_listener, TestEvent.noFilter );

    return 0;

     

    Then perform the side-by-side comparison.

     

    The last step is an output message that prints the three properties identified in the Set Up Event Listener step.

    flAssertMessage: {{flAssertMessage}}
    flAssertEvent: {{flAssertEvent}}
    flAssertTestRun: {{flAssertTestRun}}

    Attachment(s)



  • 3.  Re: How to store results of Ensure XML validation assertion in devtest 9.5.1?

    Posted Sep 10, 2017 01:32 PM

    Hi,

    It will not work for multiple assertions can we have a solution for that?

     

    Thanks,

    Naval



  • 4.  Re: How to store results of Ensure XML validation assertion in devtest 9.5.1?

    Posted Dec 02, 2016 08:16 PM

    I have tried this option and it is working fine. But if there are multiple assertions then this event is getting overriden with the latest value. So I have posted as an idea to save the assertion result to a property.