Forum Discussion

678's avatar
678
Regular Contributor
6 years ago

Test Suite is failing when executing command line where as passing using ReadyApi GUI

Test Suite is failing when executing command line where as passing using ReadyApi GUI 

 

Project 1

    Test Suite 1(Functions)

    Test Suite 2 (Actual Test Cases) 

           TestCase1 (Dependecy Step from TestSuite1)

            TestCase2 (No Dependency )

 

 

 

If i run using ReadyAPI gui running as expected as passing both test cases where as if i user command line only Test case 2 is passing where as Test case 1 failing 

 

can any one help here

  • The problem is that the workspace instance is not available when you execute via command line.

     

    Try use this code instead as proposed in the link i've send you above:

    import com.eviware.soapui.model.project.ProjectFactoryRegistry
    import com.eviware.soapui.impl.wsdl.WsdlProjectFactory
    
    def workspace = testRunner.testCase.testSuite.project.workspace
    def testProject = (workspace==null) ? 
      ProjectFactoryRegistry.getProjectFactory(WsdlProjectFactory.WSDL_TYPE).createNew("<path to your project>.xml") :
      workspace.getProjectByName("ViewingCardManager_v15B4.0")
    if(!testProject.open && workspace!=null) workspace.openProject(testProject)
    
    testProject.properties["mqResponse"].value = "blahblah"

     

  • KonstantinosLps's avatar
    KonstantinosLps
    Occasional Contributor

    Hi,

    you need to provide some code in order to get some help here.

    Generally speaking, when executing from command line, the most usual problems comes from groovy.

     

    Also, try to follow this sollution from  here and see if it works for you.

     

    Regards

    -K

    • 678's avatar
      678
      Regular Contributor

      Getting this Error 

       

      Caused by: java.lang.NullPointerException: Cannot invoke method getProjectByName() on null object
      at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91) ~[groovy-all-2.4.4.jar:2.4.4]
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48) ~[groovy-all-2.4.4.jar:2.4.4]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-all-2.4.4.jar:2.4.4]
      at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35) ~[groovy-all-2.4.4.jar:2.4.4]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-all-2.4.4.jar:2.4.4]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[groovy-all-2.4.4.jar:2.4.4]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-all-2.4.4.jar:2.4.4]
      at Script1.run(Script1.groovy:5) ~[?:?]
      at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:98) ~[ready-api-soapui-2.5.0.jar:2.5.0]
      at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83) ~[ready-api-soapui-pro-2.5.0.jar:2.5.0]
      at com.eviware.soapui.eventhandlers.support.DefaultSoapUIScript.invoke(DefaultSoapUIScript.java:42) ~[ready-api-soapui-pro-2.5.0.jar:2.5.0]
      at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:29) ~[ready-api-soapui-pro-2.5.0.jar:2.5.0]

       

      • KonstantinosLps's avatar
        KonstantinosLps
        Occasional Contributor

        The problem is that the workspace instance is not available when you execute via command line.

         

        Try use this code instead as proposed in the link i've send you above:

        import com.eviware.soapui.model.project.ProjectFactoryRegistry
        import com.eviware.soapui.impl.wsdl.WsdlProjectFactory
        
        def workspace = testRunner.testCase.testSuite.project.workspace
        def testProject = (workspace==null) ? 
          ProjectFactoryRegistry.getProjectFactory(WsdlProjectFactory.WSDL_TYPE).createNew("<path to your project>.xml") :
          workspace.getProjectByName("ViewingCardManager_v15B4.0")
        if(!testProject.open && workspace!=null) workspace.openProject(testProject)
        
        testProject.properties["mqResponse"].value = "blahblah"