Makhlo
15 years agoOccasional Contributor
Groovy teststep: Stores request/respons files in local drive
Through a groovy teststep in soapUI i want all request and response files to be stored in a local directory with system date.
The groovy teststep in soapUI:
I get the following error:
groovy.lang.MissingMethodException: No signature of method: java.lang.Boolean.plus() is applicable for argument types: (java.lang.String) values: [14062011 14:28:45_happyFlow_response.xml] Possible solutions: use([Ljava.lang.Object;), is(java.lang.Object), split(groovy.lang.Closure), wait(), any(), dump()
Can someone please tell me how to solve this error ?
The groovy teststep in soapUI:
def name = context.expand( '${Input#TG}' )
def locatie = context.expand( '${#TestCase#locatie}' )
def createFolder(locatie) {
date = new Date()
dateFormat = new java.text.SimpleDateFormat('ddMMyyyy')
shortDate = dateFormat.format(date)
outputFolder = locatie+shortDate
createFolder = new File(outputFolder)
createFolder.mkdir()
}
def getResponseFilename(shortDate,name) {
date = new Date()
dateFormat = new java.text.SimpleDateFormat('ddMMyyyy HH:mm:ss')
shortDate = dateFormat.format(date)
respFilename = shortDate+"_"+name+"_response.xml"
}
def getRequestFilename(shortDate,name) {
date = new Date()
dateFormat = new java.text.SimpleDateFormat('ddMMyyyy HH:mm:ss')
shortDate = dateFormat.format(date)
reqFilename = shortDate+"_"+ name+"_request.xml"
}
def file = new PrintWriter (createFolder(locatie)+getResponseFilename(shortDate,name))
def response = testRunner.testCase.testSteps["CheckAdres"].testRequest.response.contentAsString
file.println(response)
file.flush()
file.close()
def file2 = new PrintWriter (createFolder(locatie)+getRequestFilename(shortDate,name))
def request = context.expand('${CheckAdres#Request}')
file2.println(request)
file2.flush()
file2.close()I get the following error:
groovy.lang.MissingMethodException: No signature of method: java.lang.Boolean.plus() is applicable for argument types: (java.lang.String) values: [14062011 14:28:45_happyFlow_response.xml] Possible solutions: use([Ljava.lang.Object;), is(java.lang.Object), split(groovy.lang.Closure), wait(), any(), dump()
Can someone please tell me how to solve this error ?