Ask a Question

Events-Req/Res logging issue

SOLVED
amarnath1234
Contributor

Events-Req/Res logging issue

Hi,

 

I want to export all my Request,response and test result in text file,so for that i created a Event in Project level and try to insert script and run the TC.I observed nothing is happened ,as per my script in my project location Log folder should create and inside that folder all different text file should be export.now i ran that Groovy script and i found 1 error but I am unable to fixed it,please help.I have attached SS detail for reference.

 

below is my script.

 

def prjpath = new com.eviware.soapui.support.GroovyUtils(context).projectPath
def logFolder = new File(prjpath +'/logs')
If(!logFolder.exists()){
LogFolder.mkdirs()         //create a log folder
}
def tcName=testRunner.testCase.getName()
def tcFolder=new File(prjpath+"/logs/${tcName}")
If(!tcFolder.exists()){
tcFolder.mkdirs()
}
def FOS = new FileOutputStream(prjpath+"/logs/${tcName}"+testStepResult.testStep.name+'.txt',true)   //create text file
def pw = new PrintWriter (FOS)
testStepResult.writeTo(pw)
pw.closed()
fos.closed()

2 REPLIES 2
Radford
Super Contributor

I think the issue you have is with the case of your if statement, you have used an upper case "I" when it should be a lower case "i" also I think you may have a case issue when you use the logFolder object, you've difined it starting with a lower case "L" but reference it with an upper case "L".

yes,variables are case-sensitive.now it is working fine.

cancel
Showing results for 
Search instead for 
Did you mean: