1 /*************************************************************************
2 * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
4 * Plugin for PHP unit Testing.
7 *************************************************************************/
10 package net.sourceforge.phpeclipse.phpunit.testpool;
12 import java.util.Vector;
15 public class TestSuite {
19 private boolean hasFailure;
20 private boolean isAllPass;
21 private boolean hasError;
22 private Vector testCases; // current or actual.
23 private Vector testSuites; // current or actual.
26 private int numTestCasesExpected; //expected
27 private int numTestCasesRunSoFar;
37 public TestSuite(TestSuite parent, String name, String testID, int testCount) {
42 this.numTestCasesExpected = testCount;
44 testCases = new Vector();
45 testSuites = new Vector();
52 public void addTestCase(TestCase test) {
53 testCases.addElement(test);
54 test.setParentSuite(this);
55 numTestCasesRunSoFar++;
58 public void removeTestCase(TestCase test) {}
60 public boolean contains(TestCase test) {
66 public String toString() {
72 for(int i = 0; i < testCases.size(); i++) {
74 tc = (TestCase) testCases.elementAt(i);
75 string += " - " + tc.getTestID() + ", " + tc.getTestName() + "\n";
80 for(int i = 0; i < testSuites.size(); i++)
81 string += ((TestSuite) testSuites.elementAt(i)).toString();
83 //print its own test suites.
90 public String getId() {
97 public String getName() {
104 public int getNumTestCasesExpected() {
105 return numTestCasesExpected;
111 public void setId(String string) {
118 public void setName(String string) {
125 public void setNumTestCasesExpected(int i) {
126 numTestCasesExpected = i;
132 public void addTestSuite(TestSuite suite) {
133 testSuites.addElement(suite);
140 public boolean isFinished() {
142 return numTestCasesRunSoFar >= numTestCasesExpected;
149 public TestSuite getParent() {
156 public void setParent(TestSuite suite) {
163 public int getNumTestCases() {
165 return testCases.size();
171 public Vector getTestCases() {
178 public Vector getTestSuites() {
185 public void setTestCases(Vector vector) {
192 public void setTestSuites(Vector vector) {
199 public boolean hasError() {
205 public void setHasError() {
213 parent.setHasError();
220 public boolean hasFailure() {
226 public void setHasFailure() {
234 parent.setHasFailure();
238 public boolean isAllPass() {
240 return !hasError() && !hasFailure();