X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestSuite.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestSuite.java new file mode 100644 index 0000000..9d565da --- /dev/null +++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestSuite.java @@ -0,0 +1,206 @@ +/* + * Created on Jul 31, 2004 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package net.sourceforge.phpeclipse.phpunit.testpool; + +import java.util.Vector; + +/** + * @author Ali Echihabi + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class TestSuite { + + + + private Vector testCases; // current or actual. + private Vector testSuites; // current or actual. + private String name; + private String id; + private int numTestCasesExpected; //expected + private int numTestCasesRunSoFar; + TestSuite parent; + + /** + * @param name + * @param testID + * @param testCount + */ + public TestSuite(String name, String testID, int testCount) { + + this.parent = null; + this.id = testID; + this.name = name; + this.numTestCasesExpected = testCount; + + testCases = new Vector(); + testSuites = new Vector(); + + } + + /** + * @param name + * @param testID + * @param testCount + */ + public TestSuite(TestSuite parent, String name, String testID, int testCount) { + + this.parent = parent; + this.id = testID; + this.name = name; + this.numTestCasesExpected = testCount; + + testCases = new Vector(); + testSuites = new Vector(); + } + + public void addTestCase(TestCase test) { + testCases.addElement(test); + test.setParentSuite(this); + numTestCasesRunSoFar++; + } + + public void removeTestCase(TestCase test) {} + + public boolean contains(TestCase test) { + + return false; + + } + + public String toString() { + + String string = ""; + + //print test cases. + TestCase tc = null; + for(int i = 0; i < testCases.size(); i++) { + + tc = (TestCase) testCases.elementAt(i); + string += " - " + tc.getTestID() + ", " + tc.getTestName() + "\n"; + + + } + + for(int i = 0; i < testSuites.size(); i++) + string += ((TestSuite) testSuites.elementAt(i)).toString(); + + //print its own test suites. + return string; + } + + /** + * @return + */ + public String getId() { + return id; + } + + /** + * @return + */ + public String getName() { + return name; + } + + /** + * @return + */ + public int getNumTestCasesExpected() { + return numTestCasesExpected; + } + + /** + * @param string + */ + public void setId(String string) { + id = string; + } + + /** + * @param string + */ + public void setName(String string) { + name = string; + } + + /** + * @param i + */ + public void setNumTestCasesExpected(int i) { + numTestCasesExpected = i; + } + + /** + * @param suite + */ + public void addTestSuite(TestSuite suite) { + testSuites.addElement(suite); + + } + + /** + * @return + */ + public boolean isFinished() { + + return numTestCasesRunSoFar >= numTestCasesExpected; + + } + + /** + * @return + */ + public TestSuite getParent() { + return parent; + } + + /** + * @param suite + */ + public void setParent(TestSuite suite) { + parent = suite; + } + + /** + * @return + */ + public int getNumTestCases() { + + return testCases.size(); + } + + /** + * @return + */ + public Vector getTestCases() { + return testCases; + } + + /** + * @return + */ + public Vector getTestSuites() { + return testSuites; + } + + /** + * @param vector + */ + public void setTestCases(Vector vector) { + testCases = vector; + } + + /** + * @param vector + */ + public void setTestSuites(Vector vector) { + testSuites = vector; + } + +}