Ask a Question

Transaction Logging - Tip & Tricks 8.1 Script records all teststeps EXCEPT one!!??!?!????

SOLVED
richie
Community Hero

Transaction Logging - Tip & Tricks 8.1 Script records all teststeps EXCEPT one!!??!?!????

Hey!

 

There's been several posts relating to recording the results of all the steps within your test case/suite/project.  Tips&Tricks section 8.1 lists a small groovy script to output the results of each step in your test case

 

filePath = 'c:/users/henrik/soapUI-results/'
fos = new FileOutputStream( filePath + testStepResult.testStep.label + '.txt', true )
pw = new PrintWriter( fos )
testStepResult.writeTo( pw )
pw.close()
fos.close()

 

This was augmented when someone wanted to organise the results via a directory structure representing Project/Suite/TestCase etc.

 

HOWEVER - the script works great -both versions - but it doesn't appear to record anything for one of my steps.

 

Datasource
POST REST request
PropertyTransfer
GET REST request
DataLoop

The script doesn't record anything for my POST REST request step.  It records everything for the other steps - but it doesnt record ANYTHING for my POST step.

 

This is totally boggling me - would anyone have any ideas?

 

My Test case works fine - the POST step is executed just as the other steps are......there's just nothing being recorded for that particular step!

 

????

 

richie!

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
9 REPLIES 9
richie
Community Hero

yet again - I'm an idiot.

 

The script wasn't creating a file for the one test step because the test step name was:

 

'create/update user request'

 

spot the issue?  yeah - I didn't!

 

The script won't create a file for any step that has an oblique (/) character in there!

 

so obvious when you think about it...... so yet again I've answered my own question - sorry for wasting anyone's time!

 

richie

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

That's one of those issues that is so stupidly simple that you can catch yourself on it until you take a break and come back. Thanks for the update!




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

Hey!

 

quick question for the groovy scripters out there.

the latest version of the script records everything and splits it out into a hierarchical structure on the drive is as follows:

 

def pName = context.currentStep.testCase.testSuite.project.name //get project name
def pDate = new Date().format( 'yyyyMMdd' )//get current date
def sDate = pDate.toString()//convert date to string
def pTestSuite = context.currentStep.testCase.testSuite.name//get TestSuite name
def pTestCase = context.currentStep.testCase.name//get TestCase name
def filePath = 'D:/Donor Marketing/SoapUI/SOAPUI LOGGING SCRIPT/soapUI-results/'+pName+'_'+sDate+'/'+pTestSuite+'/'+pTestCase+'/'//compose the folder path

File file = new File(filePath)
if (!file.exists()) file.mkdirs()//create the destination folder

fos = new FileOutputStream(filePath+ testStepResult.testStep.label + '.txt', true)
pw = new PrintWriter( fos )
testStepResult.writeTo( pw )
pw.close()
fos.close()

HOWEVER - I am using this in a datalooped parameterized test case which is sourcing a hundred records from a hundred individual testdata files.

The request/response capturing is great for getting the QA Team off my back, however - the requests/responses are listed sequentially but without any identifiers indicating which instance of test case the results/responses relate to. The only thing I can do at the moment is count through the results in the particular file (associated to the test step) to find the record's results/responses I need.

I was wondering if anyone had found a way to split out the request/responses (within the test step's output file) - even if just adding a simple number to indicate which result/response was for which instance of test (e.g. so I can tell which testdata file caused the request/response details captured in the file).

hanks to any and all,

richie

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

I don't quite understand what you're asking or trying to do. Are you trying to save every test request and response in a way that's easily referenced? 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

Yeah - thats about it really.

 

The files record all the requests and responses but because I'm injecting lots of files (datasource= directory type and I have a dataloop step at the end of the test) via a single test case - it just makes it a little awkward to see which request/response is relevant.

 

cheers,

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

Bear with me, I'm still trying to wrap my head around this. What would be the difference between a test that is relevant and one that isn't? What makes a test matter in this instance? 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

I sorted it.

 

Essentially cos of the company I work for 'customer safety' is paramount - risk prioritisation is thrown out the window and exhaustive testing is the standard.  Because of this ALL test results - no matter pass or fail need to be recorded and verified by the QA people - most places they just care about passed results.

 

Anyway - because of this, the QA people wanted an easy way to identify which test generates whichever results - so I wanted to insert an identifier into the output to indicate which test caused which result - but I found a way to do this.

 

Many thanks,

 

richie

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

So how did you end up solving the problem? I'm curious to know!




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

well it certainly wasn't my genius coding skills - that's for sure! 🙂

 

I cheated....there was 1 file per test case - so I just bodged the test data so that the uniqueID of each file I submitted (was the testcase name!)

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: