nejiaziz
8 years agoNew Contributor
Reading Env variable from Jenkins through groovy script in soapui
ERROR [SoapUI] An error occurred [startup failed:
Script1.groovy: 4: unable to resolve class ParametersAction
@ line 4, column 53.
?.actions.find{ it instanceof Parameters
^
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class ParametersAction
@ line 4, column 53.The script I am running through soapui is given below. I need to read some variables from Jenkins for reporting.
import hudson.model.* // get current thread / Executor def thr = Thread.currentThread() // get current build def build = thr?.executable // get parameters def parameters = build?.actions.find{ it instanceof ParametersAction }?.parameters parameters.each { println "parameter ${it.name}:" println it.dump() println "-" * 80 } // ... or if you want the parameter by name ... def hardcoded_param = "BUILD_USER_LAST_NAME" def resolver = build.buildVariableResolverdef hardcoded_param_value = resolver.resolve(hardcoded_param)println "param ${hardcoded_param} value : ${hardcoded_param_value}"