2 * Created on Jul 31, 2004
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
7 package net.sourceforge.phpeclipse.phpunit.testpool;
9 import java.util.HashMap;
13 * @author Ali Echihabi
15 * To change the template for this generated type comment go to
16 * Window>Preferences>Java>Code Generation>Code and Comments
18 public class TestPool {
20 //private TestSuite currentParentTestSuite;
21 private HashMap tests;
22 private TestSuite root;
23 private TestSuite currentTestSuite;
29 public TestPool(String rootTitle) {
31 tests = new HashMap();
33 currentTestSuite = root;
40 public void addTest(TestCase test) {
42 tests.put(test.getTestID(), test);
44 currentTestSuite.addTestCase(test);
47 //if we run all tests. then this is the end of this test suite.
48 if( currentTestSuite != root && currentTestSuite.isFinished()) {
50 currentTestSuite = currentTestSuite.getParent();
58 * @param numTestsRunSinceStartOfTestSuite
60 public void addTestSuite(TestSuite suite) {
69 currentTestSuite.addTestSuite(suite);
70 suite.setParent(currentTestSuite);
74 currentTestSuite = suite;
80 public TestSuite getRoot() {
88 public void setRoot(TestSuite r) {
98 public TestCase getTest(String testID) {
100 return (TestCase) tests.get(testID);
103 public String toString() {
107 TestSuite node = root;
109 string = root.toString();
116 public int getNumTestsOverall() {
118 int total = root.getNumTestCasesExpected();
119 System.out.println("total: " + total);
124 public int getNumTestsRun() {
131 public int getNumFailures() {
135 // Iterator i = tests.keySet().iterator();
137 // while (i.hasNext()) {
140 // key = (String) i.next();
141 // TestCase element = (TestCase) tests.get(key);
144 // if(element.isFailure())
152 public int getNumErrors() {
156 // Iterator i = tests.keySet().iterator();
158 // while (i.hasNext()) {
161 // key = (String) i.next();
162 // TestCase element = (TestCase) tests.get(key);
164 // if(element.isError())