Test Suite that wraps all the tests of the suite in Cactus Test Case
objects so that pure JUnit tests can be run on the server side.
| Method from org.apache.cactus.internal.AbstractTestSuite Detail: |
protected void addTest(Test theTest) {
this.tests.addElement(theTest);
}
|
protected void addTestSuite(Class theTestClass) {
addTest(createTestSuite(theTestClass));
}
|
public int countTestCases() {
int count = 0;
for (Enumeration e = tests(); e.hasMoreElements();)
{
Test test = (Test) e.nextElement();
count = count + test.countTestCases();
}
return count;
}
|
abstract protected Test createCactusTestCase(String theName,
Test theTest)
|
abstract protected Test createTestSuite(Class theTestClass)
|
protected String getName() {
return this.name;
}
|
protected static Constructor getTestConstructor(Class theClass) throws NoSuchMethodException {
Constructor result;
try
{
result = theClass.getConstructor(new Class[] {String.class});
}
catch (NoSuchMethodException e)
{
result = theClass.getConstructor(new Class[0]);
}
return result;
}
Gets a constructor which takes a single String as
its argument or a no arg constructor. |
public void run(TestResult theResult) {
for (Enumeration e = tests(); e.hasMoreElements();)
{
if (theResult.shouldStop())
{
break;
}
Test test = (Test) e.nextElement();
runTest(test, theResult);
}
}
|
protected void runTest(Test theTest,
TestResult theResult) {
theTest.run(theResult);
}
|
protected void setName(String theName) {
this.name = theName;
}
|
protected Test testAt(int theIndex) {
return (Test) this.tests.elementAt(theIndex);
}
|
protected int testCount() {
return this.tests.size();
}
|
protected Enumeration tests() {
return this.tests.elements();
}
|
public String toString() {
if (getName() != null)
{
return getName();
}
return super.toString();
}
|