Forum Discussion

alivera's avatar
alivera
New Contributor
7 years ago
Solved

SoapUI :: Get Test Step Count for all test cases in a project

Hi, my name is Ali, I'm new to the forums but been using SoapUI/ReadyAPI for over a year now. I'm gonna jump straight to my question. I need help with a script to get a count of all the test steps in...
  • groovyguy's avatar
    7 years ago

    Here's something I have that is similar to what you want. It'll loop through all test suites in a project, all test cases in a suite, and count all the test steps in each test case.

     

    def testStepCount = 0;
    def project = context.testCase.testSuite.project;
    
    for (int i = 0; i < project.getTestSuiteCount(); i++)
    {
    	def testSuite = project.getTestSuiteAt(i);
    	def testCaseCount = testSuite.getTestCaseCount();
    	for (int j = 0; j < testCaseCount; j++)
    	{
    		def testCase = testSuite.getTestCaseAt(j);
    		testStepCount = testStepCount + testCase.getTestStepCount();
    	}
    }
    
    log.info("Total Test Steps: " + testStepCount.toString());