Forum Discussion

URN123's avatar
URN123
Occasional Contributor
11 years ago

How to save the Test Case Execution time using groovy

Hi,

I want to save the test case execution time using groovy. My testcase looks something like this:

Here are the steps in my testcase:

DataSource
DataGen
Properties
Groovy Script1
Property Transfer1
REST Request1
Groovy Script2
Property Transfer2
REST Request2
Groovy Script3
Property Transfer3
REST Request3
DataSink
DataSource Loop

I am reading/writing data from/to an excel sheet.
Each row in the excel is a test case. So I want to calculate the time taken to execute the steps for each row?
Soap is printing a time in the logs, but that is the time taken to execute all the rows in the excel.

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    You can use event handlers TestRunListener.beforeStep and TestRunListener.afterStep. Save the start time in TestRunListener.beforeStep to a property, and calculate how much time has passed in TestRunListener.afterStep.


    Please use this link as a reference on event handlers:
    http://www.soapui.org/Scripting-Propert ... dlers.html



    Regards,
    Marcus
    SmartBear Support
  • eeenimisha's avatar
    eeenimisha
    New Contributor

    I too have a similar scenario where each row in my excel sheet represents a new test case.Each row has been given a separate testcase name. So, I would like to know if it is possible to get that test case name corresponding to each row using Custom event listeners in Soap UI? As of now I can only get the upper level testcase names using "TestRunListener.beforeRun" --> "testRunner.testCase.name".

    • groovyguy's avatar
      groovyguy
      Champion Level 1

      eeenimisha, you're replying to a thread that's 4+ years old. You may want to consider making a new thread instead of bumping this one.