cancel
Showing results for 
Search instead for 
Did you mean: 

Events-Req/Res logging issue

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

Re: Events-Req/Res logging issue

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

View solution in original post

2 REPLIES 2
Highlighted
Super Contributor

Re: Events-Req/Res logging issue

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".

Highlighted
Contributor

Re: Events-Req/Res logging issue

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

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!


Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors