cancel
Showing results for 
Search instead for 
Did you mean: 

how to capture time stamp & time taken for each request and put it in excel

rayapudi904
Occasional Contributor

how to capture time stamp & time taken for each request and put it in excel

HI

 

I am setting up a data driven framework

As part of my requirmnet i supposed to capture Time Taken & Time stamp for each request .

 

I have tried with events but no luck. Could you please help me on this.

 

Regards,

Rajesh

11 REPLIES 11
TanyaYatskovska
Community Manager

Re: how to capture time stamp & time taken for each request and put it in excel

Hi Rajesh,

 

Please take a look at this topic where a similar question was discussed: http://community.smartbear.com/t5/SoapUI-NG/Appending-time-stamp-to-a-request-parameter-name/td-p/35...

 

Does it answer your question?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
nmrao
Community Hero

Re: how to capture time stamp & time taken for each request and put it in excel

You may use Events, Submit Listener before and after submit to log the time.


Regards,
Rao.
rayapudi904
Occasional Contributor

Re: how to capture time stamp & time taken for each request and put it in excel

I have tried using events but no luck. Could you please provide some sample.

 

Thanks,

Rajesh

nmrao
Community Hero

Re: how to capture time stamp & time taken for each request and put it in excel

Please show what you tried, so that it can be corrected.


Regards,
Rao.
rayapudi904
Occasional Contributor

Re: how to capture time stamp & time taken for each request and put it in excel

Hi Rao,

 

Please find the below sample

 

Event : TestRunListener.afterStep

 

def step = testStepResult.testStep.name
log.info step

def stamp = testStepResult.timeStamp
def timeTaken = testStepResult.timeTaken

testRunner.testCase.getProperty("TimeStamp").setValue(stamp)
testRunner.testCase.getProperty("TimeTaken").setValue(timeTaken)

 

 

 

 

nmrao
Community Hero

Re: how to capture time stamp & time taken for each request and put it in excel

In fact, below gives what you looking for even without using events. Use it in Script Assertion

 

log.info messageExchange.response.timeTaken

 

Does it solves?



Regards,
Rao.
nmrao
Community Hero

Re: how to capture time stamp & time taken for each request and put it in excel

So, what is the issue with above script?


Regards,
Rao.
rayapudi904
Occasional Contributor

Re: how to capture time stamp & time taken for each request and put it in excel

Whe ni use the below event

 

Event : TestRunListener.afterStep

 

def step = testStepResult.testStep.name
log.info step

def stamp = testStepResult.timeStamp
def timeTaken = testStepResult.timeTaken

testRunner.testCase.getProperty("TimeStamp").setVa​lue(stamp)
testRunner.testCase.getProperty("TimeTaken").setVa​lue(timeTaken)

 

It is not capturing any data in the property.

 

Using the log.info messageExchange.response.timeTaken i can print the values in log file, but how to capture in ay of the property which in turn using data sink i can pass it to output file.

 

I am using Ready API 1.3.1 version. Please advice

nmrao
Community Hero

Re: how to capture time stamp & time taken for each request and put it in excel

Ok, let me give an example to capture the response time into test case level property, RESPONSE_TIME as shown below in the Script Assertion and the same works both in free and pro versions as well.

 

//Check if there is a value in the response time taken using assert
assert messageExchange.response.timeTaken, "Response time is empty or null"

//set the value to test case level custom property
context.testCase.setPropertyValue('RESPONSE_TIME', (messageExchange.response.timeTaken).toString())


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors