Lucian
7 years agoCommunity Hero
Sharing is caring - groovy script to log the test execution duration for every test suite/test case
The following is a TearDown script to log test execution duration for every test suite and test case.
// Define variables for holding test suites, test cases and test steps def testSuites def testCases // Get the list of test suites testSuites = runner.getResults() // Iterate through each test suite testSuites.each() { log.info "----------------------------------------" log.info "The test suite " + "'" + it.getTestSuite().getName() +"'" + " took " + it.getTimeTaken() + "ms to finish." log.info "The following are the contained test cases along with their durations..." // Get all the test cases and iterate through them testCases = it.getResults() testCases.each() { log.info "...the test case " + "'" + it.getTestCase().getName() +"'" + " - " + it.getTimeTaken() + "ms." } }