SOAPUI Execute External Groovy Code

import groovy.lang.Binding
import groovy.util.GroovyScriptEngine
 
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
 
// define location of script file relative to project file.
String projectPath = groovyUtils.projectPath + "/groovy/"
 
// Create Groovy Script Engine to run Script.
GroovyScriptEngine gse = new GroovyScriptEngine(projectPath) 
 
// Load the Groovy Script file 
externalScript = gse.loadScriptByName("Utility.groovy")  
 
// Create a runtime instance of script
instance = externalScript.newInstance()
 
// Sanity check 
assert instance!= null
 
// run a method in external script
instance.foo()

execute_external_groovy_script.txt ยท Last modified: 2015/07/16 12:53 by Martin Spamer