Forum Discussion

autoscout24's avatar
autoscout24
Contributor
14 years ago

script lib location into testrunner.bat file

Hi guys,
We run our test suites via the command line using testRunner.bat. we do have lot of script library function in the load script of the project for example the below one

def scriptLibrary = context.expand('${projectDir}')+"\\scripts";
com.eviware.soapui.SoapUI.settings.setString( "Script Library", scriptLibrary);

Thread.sleep(2000);

def LoadScript = new soapui.AS24.ProjectLoadScript(log, context, project)


error displayed

Thu Nov 17 12:12:33 CET 2011:ERROR:An error occured [startup failed:
Script2.groovy: 6: unable to resolve class soapui.AS24.ProjectLoadScript
@ line 6, column 18.
def LoadScript = new soapui.AS24.ProjectLoadScript(log, context, project)
^
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class soapui.AS24.ProjectLoadScript
@ line 6, column 18.
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:148)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:229)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:239)
at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:1069)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:754)
at org.codehaus.groovy.control.ResolveVisitor.transformDeclarationExpression(ResolveVisitor.java:1110)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:746)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:139)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:165)
at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1337)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:50)
at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:173)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1278)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148)
at org.codehaus.groovy.control.CompilationUnit$8.call(CompilationUnit.java:601)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:839)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:544)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:493)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731)
at groovy.lang.GroovyShell.parse(GroovyShell.java:743)
at groovy.lang.GroovyShell.parse(GroovyShell.java:770)
at groovy.lang.GroovyShell.parse(GroovyShell.java:761)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:148)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:88)
at com.eviware.soapui.impl.wsdl.WsdlProject.runAfterLoadScript(WsdlProject.java:1428)
at com.eviware.soapui.impl.wsdl.panels.project.WsdlProjectDesktopPanel$LoadScriptGroovyEditorModel$AfterLoadScriptRunAction.actionPerformed(WsdlProjectDesktopPanel.java:439)
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.AWTEventMulticaster.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$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$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)

1 error
], see error log for details



it could be delay problem..i don't know how to over come it.....

Is it possible to specify the script library location inside the testrunner.bat and soapui-pro.bat, so that the tool loads with the correct script library location.

Regards
Vijay
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Vijay,

    you can use the soapui.scripting.library system property to override the location of the script library - try adding that to the bat file, ie

    -Dsoapui.scripting.library=<your script library path>

    Does that help?

    regards!

    /Ole
    SmartBear Software
  • Any way to do this by groovy script?
    I want to be able to retrieve the Global Script library location.

    Thanks

    Shiang
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    You should be able to extract the parameter like this
    log.info System.properties["soapui.scripting.library"]


    --
    Regards

    Erik
    SmartBear Sweden
  • SmartBear Support wrote:
    Hi!

    You should be able to extract the parameter like this
    log.info System.properties["soapui.scripting.library"]


    --
    Regards

    Erik
    SmartBear Sweden


    Erik,

    I need it to get the one set in the Application level (preferences/soapui pro/script library). That System properties above doesn't seem to work, returns null. I will look into that System properties. If it helps you, i'm using 4.5.1.1.

    Thanks,

    Shiang
  • SmartBear Support wrote:
    Hi,

    The test runner should take the argument -t /path/to/settings-file.xml

    http://www.soapui.org/Test-Automation/f ... tests.html

    Does that work for you?

    Henrik
    SmartBear Software


    Henrik,
    I'm not using the testrunner argument. My mistake. I'm trying to do it within soapui itself through groovy script, within the groovy script library directory I have some xsds I want to get too. So If I can get the location of the groovy script library, I can get to those xsds.

    Thanks,

    Shiang
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    Sorry, but have you added the system property to your bat file as suggested by Ole?
    And if that system property is not set, the default location is SOAPUI_HOME/bin/scripts

    --
    Regards

    Erik
    SmartBear Sweden