View Javadoc

1   /*
2    *  soapUI, copyright (C) 2007-2009 eviware software ab 
3    */
4   package com.eviware.soapui.model.support;
5   
6   import com.eviware.soapui.model.testsuite.Assertable;
7   import com.eviware.soapui.model.testsuite.TestCase;
8   import com.eviware.soapui.model.testsuite.TestStep;
9   import com.eviware.soapui.model.testsuite.TestSuite;
10  
11  public class TestSuiteMetrics
12  {
13  	final private TestSuite testSuite;
14  
15  	public TestSuiteMetrics(TestSuite testSuite)
16  	{
17  		this.testSuite = testSuite;
18  	}
19  
20  	public int getTestCaseCount()
21  	{
22  		return testSuite.getTestCaseCount();
23  	}
24  
25  	public int getTestStepCount()
26  	{
27  		int result = 0;
28  
29  		for (TestCase testCase : testSuite.getTestCaseList())
30  		{
31  			result += testCase.getTestStepCount();
32  		}
33  
34  		return result;
35  	}
36  
37  	public int getAssertionCount()
38  	{
39  		int result = 0;
40  
41  		for (TestCase testCase : testSuite.getTestCaseList())
42  		{
43  			for (TestStep testStep : testCase.getTestStepList())
44  			{
45  				if (testStep instanceof Assertable)
46  				{
47  					result += ((Assertable) testStep).getAssertionCount();
48  				}
49  			}
50  		}
51  
52  		return result;
53  	}
54  
55  	public int getLoadTestCount()
56  	{
57  		int result = 0;
58  		for (TestCase testCase : testSuite.getTestCaseList())
59  		{
60  			result += testCase.getLoadTestCount();
61  		}
62  		return result;
63  	}
64  
65  }