Forum Discussion
morciani
15 years agoOccasional Contributor
Excellent!!!! Thank you!!! I REALLY appreciate the time you devoted to this. I had something similar, but I didn't have the file.flush() or file.close() references. This works great. the final version looks like this:
//Output the request and response to a local directory
def name = context.expand( '${DataGen#CompanysQuoteNumber}' )
def location = context.expand( '${Properties#Location}' )
def getResponseFilename(name) {
date = new Date()
dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")
shortDate = dateFormat.format(date)
respFilename = name + "_Rs_" + shortDate + ".xml"
}
def getRequestFilename(name) {
reqFilename = name + "_Rq_" + shortDate + ".xml"
}
def file = new PrintWriter (location + getResponseFilename(name))
def Response = testRunner.testCase.testSteps["TestRequest_TPPR"].testRequest.response.contentAsString
file.println(Response)
file.flush()
file.close()
def file2 = new PrintWriter (location + getRequestFilename(name))
def Request = context.expand( '${TestRequest_TPPR#Request}' )
file2.println(Request)
file2.flush()
file2.close()
//Output the request and response to a local directory
def name = context.expand( '${DataGen#CompanysQuoteNumber}' )
def location = context.expand( '${Properties#Location}' )
def getResponseFilename(name) {
date = new Date()
dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")
shortDate = dateFormat.format(date)
respFilename = name + "_Rs_" + shortDate + ".xml"
}
def getRequestFilename(name) {
reqFilename = name + "_Rq_" + shortDate + ".xml"
}
def file = new PrintWriter (location + getResponseFilename(name))
def Response = testRunner.testCase.testSteps["TestRequest_TPPR"].testRequest.response.contentAsString
file.println(Response)
file.flush()
file.close()
def file2 = new PrintWriter (location + getRequestFilename(name))
def Request = context.expand( '${TestRequest_TPPR#Request}' )
file2.println(Request)
file2.flush()
file2.close()
Related Content
- 6 years ago
- 8 years ago
Recent Discussions
- 6 days ago