Hi all,
In the last period I've updated my Groovy-script (executed as RequestFilter.filterRequest-event) to the one below, where my goal is to add a headervalue only to the requestst that have a specific value in the name.
// Define input-file
def token = new File('C:/temp/SOAPUI/PmAuthenticationToken.txt').text
def name = context.getCurrentStep().getLabel()
log.info name
if (name.contains("NOTOKEN")){
//Skip all Steps with tag NOTOKEN
log.info ("**NOTOKEN**")
}
else
{
log.info ("**TOKEN**")
if (token) {
def headers = request.requestHeaders
headers['PmAuthenticationToken'] = [token]
request.requestHeaders = headers
}
else {
log.error("File 'C:/temp/SOAPUI/PmAuthenticationToken.txt' is not present")
}
}
From the Ready! API toolset, I can run this event within the SoapUI NG part with no problems on Project-, TestCase- and TestSuit-level.
But when I go to Projects - in the Ready! API toolset - I recieve an error like:
Thu Jan 28 15:32:32 CET 2016:ERROR:groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlSubmitContext.getCurrentStep() is applicable for argument types: () values: []
groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlSubmitContext.getCurrentStep() is applicable for argument types: () values: []
Is it possible to modify this GROOVY-script in such a way that is it working both under Projects and in SoapUI NG on Project-, TestCase- and TestSuit-level?