Forum Discussion
Department_of_T
12 years agoContributor
I have the code as a 'script assertion' in the XML file. I have now changed this to an event handler but i cannot see any logs. I am attempting to use dates/times as a directory structure do to the sheer volume of tests that we run. Can anyone see a problem with the below event handler?
//new File(directory).mkdirs()
def time() {
date = new Date()
dateFormat = new java.text.SimpleDateFormat('HH-mm-ss-SSS')
shortDateName = dateFormat.format(date)
return shortDateName
}
def date() {
date = new Date()
dateFormat = new java.text.SimpleDateFormat('ddMMyyyy')
shortDateName = dateFormat.format(date)
return shortDateName
}
def directory = "C:/SoapOutput/" + date() + "/"+ time()
fos = new FileOutputStream( directory + testStepResult.testStep.label + '.txt', true )
pw = new PrintWriter( fos )
testStepResult.writeTo( pw )
pw.close()
fos.close()