Service Virtualization

Expand all | Collapse all

Generating a test resport from comparision of two xml responses

Jump to Best Answer
  • 1.  Generating a test resport from comparision of two xml responses

    Posted 04-28-2017 01:13 PM

    Pls clarify  In case of using xml by xml assertion , from assertion results can we use the assertion result to generate a report like pass or fail status ?

     

    Or 

     

    If i write a java program after write properties to file, and have that program as a jar file where to place the jar file?



  • 2.  Re: Generating a test resport from comparision of two xml responses
    Best Answer

    Posted 04-28-2017 02:25 PM

    For saving assertion result in a property ;

    Refer https://communities.ca.com/thread/241731639?commentID=241803481#comment-241803481 

     

    If you write a java code, and you export it in for of jar file. You need to drop the JAR file in Hot Deploy. 

    You can use Dynamic Java Execution step to access the class and functions that you have created in Java code.

    Refer: Dynamic Java Execution - DevTest Solutions - 10.0 - CA Technologies Documentation 

     

    Thanks,

    Monika



  • 3.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-16-2017 08:29 AM
      |   view attached

    Hi Monika 

     

    Facing issues in importing the jar file. PLease find below the project and the jar 

     

    Placed the xml comparision jar in the below folders

     

    C:\Program Files\CA\Lisa\hotDeploy

     

    C:\Program Files\CA\DevTest\lib

     

    Attachment(s)

    zip
    XMLComparison.zip   109K 1 version


  • 4.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-16-2017 11:03 AM

    Like I suggested before please use dynamic java execution step for this.

     

    Also, I would suggest you to create method and take input values instead of using Java Script step.



  • 5.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-18-2017 11:40 AM

    IN dynamic java step , I am not getting the object call tree . Its not able to read the class , method thats been used inside the xml comparision program . Program is attached above. Customized jar is compiled usign jdk 1.8 .its giving unsupported major .minor version error 52 in ITR for the java script step . Can you please let me know the jars or any versions that needs to be upgraded. I am using a map , xml compare methods whcih is 1.8 compatible



  • 6.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-18-2017 11:50 AM

    Try with jar compiled using jdk 1.7 version since you are on old devtest version.



  • 7.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-18-2017 02:08 PM

    The customised jar is made using the methods that are 1.8 compatible and i am facing issue with xmlunit jar

     

    I tried with xmlunit jar 1.2 and 1.6 in \Lisa\hotDeploy\ and in lib . Pls suggest to get rid of this error . 



  • 8.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-18-2017 04:39 PM

    What is the error you are getting when you are compiling it with java version 1.7?



  • 9.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-19-2017 06:32 AM

    I just tried with jdk 1,7 jar simple jar [attached here] , Its not loading in Dynamic Java execution step and lisa got stucked 

     

    PLs quicky guide me how to connect to external jars and get rid of this issue.

     

    I placed this jar under 

    C:\Program Files\CA\DevTest\lib

    C:\Program Files\CA\DevTest\hotDeploy


    Do we have to follow any other steps ? 

     

     

    When tried with java script step , 

     

    In javascript step ,

     

    import com.util.MySampleProject;

    doVersionCheck();

     

     

    ============================================================================

    | Error in Script

    ============================================================================

    | Step:        Java Script Step

    ----------------------------------------------------------------------------

    | Message:     Sourced file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : Attempt to resolve method: doVersionCheck() on undefined variable or class name: MySampleProject : at Line: 2 : in file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : MySampleProject .doVersionCheck ( )

     

    ----------------------------------------------------------------------------

    | Trapped Exception: Sourced file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : Attempt to resolve method: doVersionCheck() on undefined variable or class name: MySampleProject : at Line: 2 : in file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : MySampleProject .doVersionCheck ( )

     

    | Trapped Message:   bsh.EvalError: Sourced file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : Attempt to resolve method: doVersionCheck() on undefined variable or class name: MySampleProject : at Line: 2 : in file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : MySampleProject .doVersionCheck ( )

     

    ----------------------------------------------------------------------------

    STACK TRACE

    bsh.EvalError: Sourced file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : Attempt to resolve method: doVersionCheck() on undefined variable or class name: MySampleProject : at Line: 2 : in file: inline evaluation of: ``import com.util;  MySampleProject.doVersionCheck();'' : MySampleProject .doVersionCheck ( )

     

                    at bsh.UtilEvalError.toEvalError(UtilEvalError.java:89)

                    at bsh.UtilEvalError.toEvalError(UtilEvalError.java:94)

                    at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:99)

                    at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)

                    at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)

                    at bsh.Interpreter.eval(Interpreter.java:664)

                    at bsh.Interpreter.eval(Interpreter.java:758)

                    at bsh.Interpreter.eval(Interpreter.java:747)

                    at com.itko.lisa.test.ScriptExecHandler.executeScript(ScriptExecHandler.java:635)

                    at com.itko.lisa.test.ScriptExecHandler.executeScriptOld(ScriptExecHandler.java:527)

                    at com.itko.lisa.test.ScriptNode._execute(ScriptNode.java:127)

                    at com.itko.lisa.editor.ScriptNodeEditor.execute(ScriptNodeEditor.java:100)

                    at com.itko.lisa.editor.ScriptNodeEditor.access$000(ScriptNodeEditor.java:42)

                    at com.itko.lisa.editor.ScriptNodeEditor$1.actionPerformed(ScriptNodeEditor.java:61)

                    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

                    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

                    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

                    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

                    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

                    at java.awt.Component.processMouseEvent(Unknown Source)

                    at javax.swing.JComponent.processMouseEvent(Unknown Source)

                    at java.awt.Component.processEvent(Unknown Source)

                    at java.awt.Container.processEvent(Unknown Source)

                    at java.awt.Component.dispatchEventImpl(Unknown Source)

                    at java.awt.Container.dispatchEventImpl(Unknown Source)

                    at java.awt.Component.dispatchEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

                    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

                    at java.awt.Container.dispatchEventImpl(Unknown Source)

                    at java.awt.Window.dispatchEventImpl(Unknown Source)

                    at java.awt.Component.dispatchEvent(Unknown Source)

                    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

                    at java.awt.EventQueue.access$200(Unknown Source)

                    at java.awt.EventQueue$3.run(Unknown Source)

                    at java.awt.EventQueue$3.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.awt.EventQueue$4.run(Unknown Source)

                    at java.awt.EventQueue$4.run(Unknown Source)

                    at java.security.AccessController.doPrivileged(Native Method)

                    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                    at java.awt.EventQueue.dispatchEvent(Unknown Source)

                    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                    at java.awt.EventDispatchThread.run(Unknown Source)

    Caused by: bsh.UtilEvalError: Attempt to resolve method: doVersionCheck() on undefined variable or class name: MySampleProject

                    at bsh.Name.invokeMethod(Name.java:835)

                    at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:75)

                    ... 47 more

    ============================================================================



  • 10.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-19-2017 07:25 AM
      |   view attached

    Error snap shot for dynamic java execution step is attached here with



  • 11.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-19-2017 10:29 AM

    Have you removed old jar from lib or hot Deploy? Please put jar only in Hot Deploy



  • 12.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-22-2017 08:34 AM
      |   view attached

    Many thanks monika . Yes removed old jar and replaced it with the new one from jdk 1.7 

     

    Can you please help me to solve this error while using dynamic java execution step 

    Appreciate solution for this . Jars are attached here . On clicking Construct/Load Object , getting the below error. Please let me know wat i am missing here 

     

    Attachment(s)

    zip
    JAR.zip   21K 1 version


  • 13.  Re: Generating a test resport from comparision of two xml responses

    Posted 05-23-2017 02:21 PM

    Hi Rajeshwari,

     

    It worked perfect in my machine. see below:

    Can you check what is the version of windows, Devtest and eclipse that you are using, make sure they are of same version 32/64 bit... This could be the issue but I am not sure. Please check and see if it works.