Forum Discussion

jkrier's avatar
jkrier
Regular Contributor
10 years ago

Groovy script for running curl commands

Does anyone know how to run a curl command using a Groovy script inside SoapUI? I found some JS scripts that supposedly do this but I think you need Test Complete to run them as they all fail for me in SoapUI

  • Looks like curl was not found on the path. Try specifying the complete path of the executable, ie "/usr/bin/curl"

     

    Anders

    Ready! API developer

    • jkrier's avatar
      jkrier
      Regular Contributor

      I get an error when I run that

       

      • Sat Sep 05 12:26:37 MDT 2015:ERROR:groovy.lang.MissingPropertyException: No such property: org for class: Script1
      • groovy.lang.MissingPropertyException: No such property: org for class: Script1
      • at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
      • at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
      • at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
      • at Script1.run(Script1.groovy:6)
      • at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
      • at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:79)
      • at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:138)
      • at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
      • at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      • at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      • at java.lang.Thread.run(Unknown Source)
      • jkrier's avatar
        jkrier
        Regular Contributor

        I tried shortening the script as some of the timesampt stuff isn't necessary for me and then I get an error when trying to execute the curl command, which is what I am use to seeing

         

        modified script

        def proc = "curl https://hostname/manager/text/list/".execute()
        // cURL uses error output stream for progress output.
        Thread.start { System.err << proc.err }
        // Wait until cURL process finished and continue with the loop.
        proc.waitFor()

         

        ERROR

        java.io.IOException: Cannot run program "curl": CreateProcess error=2, The system cannot find the file specified error at line: 1