Forum Discussion

amarnath1234's avatar
amarnath1234
Contributor
6 years ago
Solved

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

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

2 Replies

  • Radford's avatar
    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".

    • amarnath1234's avatar
      amarnath1234
      Contributor

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