1 /*************************************************************************
2 * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
4 * Plugin for PHP unit Testing.
7 *************************************************************************/
9 package net.sourceforge.phpeclipse.phpunit.testpool;
11 import java.util.Vector;
13 public class TestSuite {
15 private boolean hasFailure;
17 //private boolean isAllPass;
19 private boolean hasError;
21 private Vector testCases; // current or actual.
23 private Vector testSuites; // current or actual.
29 private int numTestCasesExpected; // expected
31 private int numTestCasesRunSoFar;
40 public TestSuite(TestSuite parent, String name, String testID, int testCount) {
45 this.numTestCasesExpected = testCount;
47 testCases = new Vector();
48 testSuites = new Vector();
55 public void addTestCase(TestCase test) {
56 testCases.addElement(test);
57 test.setParentSuite(this);
58 numTestCasesRunSoFar++;
61 public void removeTestCase(TestCase test) {
64 public boolean contains(TestCase test) {
70 public String toString() {
76 for (int i = 0; i < testCases.size(); i++) {
78 tc = (TestCase) testCases.elementAt(i);
79 string += " - " + tc.getTestID() + ", " + tc.getTestName() + "\n";
83 for (int i = 0; i < testSuites.size(); i++)
84 string += ((TestSuite) testSuites.elementAt(i)).toString();
86 // print its own test suites.
93 public String getId() {
100 public String getName() {
107 public int getNumTestCasesExpected() {
108 return numTestCasesExpected;
114 public void setId(String string) {
121 public void setName(String string) {
128 public void setNumTestCasesExpected(int i) {
129 numTestCasesExpected = i;
135 public void addTestSuite(TestSuite suite) {
136 testSuites.addElement(suite);
143 public boolean isFinished() {
145 return numTestCasesRunSoFar >= numTestCasesExpected;
152 public TestSuite getParent() {
159 public void setParent(TestSuite suite) {
166 public int getNumTestCases() {
168 return testCases.size();
174 public Vector getTestCases() {
181 public Vector getTestSuites() {
188 public void setTestCases(Vector vector) {
195 public void setTestSuites(Vector vector) {
202 public boolean hasError() {
208 public void setHasError() {
216 parent.setHasError();
222 public boolean hasFailure() {
228 public void setHasFailure() {
236 parent.setHasFailure();
239 public boolean isAllPass() {
241 return !hasError() && !hasFailure();