Showing results for 
Search instead for 
Did you mean: 

Test run groovy statistics

Community Hero

Test run groovy statistics

As suggested by @Olga_T I will share a script which logs in the status of the test suites / test cases. Hereby I created the following project TearDown script:


// Define variables for holding test suites, test cases and test steps
def testSuites
def testCases
def passedTestCases = 0
def failedTestCases = 0

// Get the list of test suites
testSuites = runner.getResults() 

// Iterate through each test suite
testSuites.each() { "----------------------------------------" "The test suite " + "'" + it.getTestSuite().getName() +"'" + " has the status " + it.getStatus() + "." "The following are the contained test cases..."

	// Get all the test cases and iterate through them
	testCases = it.getResults()
	testCases.each() { "...the test case " + "'" + it.getTestCase().getName() +"'" + " with the status " + it.getStatus() + "."
		if ( it.getStatus().toString().equals("PASS") ) {
		} else {
	} "The number of passed test cases is " + passedTestCases.toString() + " while the number of failed test cases is " + failedTestCases.toString() + "."
	passedTestCases = 0
	failedTestCases = 0

If my answer helped please click on the 'Accept as Solution' button.
Tags (1)
Community Manager

Thanks for preparing the code, Lucian. I've added the TechCorner label to your topic. Feel free to use it when you post any interesting and useful samples or How To articles. 

Great contribution to API Summer and the well-deserved win last week! Congrats!

Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Community Hero

Thanks Tanya! Smiley Happy

If my answer helped please click on the 'Accept as Solution' button.
New Here?
Join us and watch the welcome video:
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Get a full Raw JMS request


Compare an expected JSON value and actual response in Events


Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Top Kudoed Authors