Service Virtualization

 View Only
  • 1.  How to get field in Test Event tab (ITR) in assertion script like String.

    Posted Jul 13, 2016 05:21 AM
      |   view attached

    Hello all,

     

    I did test with Graphical XML Side-by-Side Comparison and got differences of XML, but only in "console".

     

    I want to put it on some property for future sending all the text in email step.

     

    This thought to take all of the text through a script.

     

    Or maybe have another way to do it?



  • 2.  Re: How to get field in Test Event tab (ITR) in assertion script like String.

    Posted Jul 13, 2016 04:37 PM
      |   view attached

    Hi Orlan03, I believe it is possible to get at the message by setting up a custom listener to trap the assertion. 

    Let me begin by saying that I am not 100% certain that the attached 'hack' uses the correct Event filter.  Maybe someone with more experience can provide better guidance.

     

    The idea is:

    1) Add a step (I used a JSR-223) prior to the step that contains the Side-by-Side-Comparison. 

        This step initializes and adds a Custom Event Listener that stores the long message value for Test Event Assertion.

        It also initializes a property that the long message is moved into

     

    2) Set your Graphical Compare assertion to branch to a step that processes the result when the Side-By-Side Comparison fails.  This model assumes that you do not care to record the content when the compare matches.

     

    3) In the step that fires when the assertion fails, access the long message that was trapped by your Custom Listener and append it into a property. 

     

    4) The last step removes the Custom Listener.

    The attached test case is a hack, but hopefully it gets you a little closer to a resolution.  The sample demonstrates appending the output from multiple Side-by-Side compares into a single file.  If you make one of your compares equal / equal, the assertion does not fail and the step branches around dropping the long message into the property.  Maybe this could be done in a subprocess -- not sure.

    Attachment(s)

    zip
    x.tst.zip   2 KB 1 version


  • 3.  Re: How to get field in Test Event tab (ITR) in assertion script like String.

    Posted Jul 20, 2016 05:32 AM

    Thanks to John Van der Leij I found this link here with the JavaScript code for my question.

     

    http://www.ca.com/us/support/ca-support-online/product-content/knowledgebase-articles/tec1427335.aspx

     

    But when you try to use this code I came across some problems.

     

    Maybe someone faced with the same issue.

     

    JS issue.png

    development environment of script in DevTest gives an error message.

     

    Just if I make little changes the code compiled successfully.

     

    JS issue_2.png

     

    But when I try to test it I get this error:

    JS issue_3.png

    After a long investigation, I saw that in this java TestEvent class doesn't have default public constructor.

    He is there but with an access modifier, private .

     

    Maybe I missed something here?