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;
10 import java.util.Iterator;
11 import java.util.Vector;
15 * @author Ali Echihabi
17 * To change the template for this generated type comment go to
18 * Window>Preferences>Java>Code Generation>Code and Comments
20 public class TestPool {
22 //private TestSuite currentParentTestSuite;
23 private HashMap tests;
24 private TestSuite root;
25 private TestSuite currentTestSuite;
31 public TestPool(String rootTitle) {
33 tests = new HashMap();
35 currentTestSuite = root;
42 public void addTest(TestCase test) {
44 tests.put(test.getTestID(), test);
46 currentTestSuite.addTestCase(test);
49 //if we run all tests. then this is the end of this test suite.
50 if( currentTestSuite != root && currentTestSuite.isFinished()) {
52 currentTestSuite = currentTestSuite.getParent();
60 * @param numTestsRunSinceStartOfTestSuite
62 public void addTestSuite(TestSuite suite) {
71 currentTestSuite.addTestSuite(suite);
72 suite.setParent(currentTestSuite);
76 currentTestSuite = suite;
82 public TestSuite getRoot() {
90 public void setRoot(TestSuite r) {
100 public TestCase getTest(String testID) {
102 return (TestCase) tests.get(testID);
105 public String toString() {
109 TestSuite node = root;
111 string = root.toString();
118 public int getNumTestsOverall() {
120 int total = root.getNumTestCasesExpected();
121 System.out.println("total: " + total);
126 public int getNumTestsRun() {
133 public int getNumFailures() {
137 // Iterator i = tests.keySet().iterator();
139 // while (i.hasNext()) {
142 // key = (String) i.next();
143 // TestCase element = (TestCase) tests.get(key);
146 // if(element.isFailure())
154 public int getNumErrors() {
158 // Iterator i = tests.keySet().iterator();
160 // while (i.hasNext()) {
163 // key = (String) i.next();
164 // TestCase element = (TestCase) tests.get(key);
166 // if(element.isError())