cancel
Showing results for 
Search instead for 
Did you mean: 

Events-Req/Res logging issue

SOLVED
Dear Community, API Masterminds week 4 has started!

Participate in the exciting online event by posting questions or replies and win! During the entire March, we decide top contributors each week and reward them with great gifts . Congratulate the winners of Week 3 here.
Week 4 task: Ask more questions, bring interesting topics and reply to existing ones in the ReadyAPI Community
Topics to participate in:
See All
Week 4 Leaders:
Members with the biggest number of posts
HimanshuTayal 17 posts
nmrao 15 posts
richie 2 posts
pizzaTime 1 posts
PratikshaMehete 1 posts
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:
Join 2020 API Masterminds
We invite all lovers of API testing to participate in the API Masterminds event. Ask questions or help others by giving solutions and get rewarded.
>> Participate Today
Get Your Free Ticket
SBC2020
Top Kudoed Authors