Forum Discussion
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)
- nmrao9 years agoChampion Level 3
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?
- rayapudi9049 years agoOccasional Contributor
Whe ni use the below event
Event : TestRunListener.afterStep
def step = testStepResult.testStep.name
log.info stepdef stamp = testStepResult.timeStamp
def timeTaken = testStepResult.timeTakentestRunner.testCase.getProperty("TimeStamp").setValue(stamp)
testRunner.testCase.getProperty("TimeTaken").setValue(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
- nmrao9 years agoChampion Level 3
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())
- nmrao9 years agoChampion Level 3So, what is the issue with above script?