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()


You could start with a different date format, since ":" is not accepted in a filename, try:

shortDate = new Date().format("ddMMyyyy HHmmss").toString();



The error occurs because of your line:

def file = new PrintWriter (createFolder(locatie)+getResponseFilename(shortDate,name))



If I run the following line against your script, it returns a boolean, hence the boolean.plus.

log.info createFolder(locatie)



The script seems to run if I add the following line at the end of createFolder(locatie):

return outputFolder


블로그 이미지

요다할아범

,