Methods Summary |
---|
public synchronized void | addError(junit.framework.Test test, java.lang.Throwable t)Adds an error to the list of errors. The passed in exception
caused the error.
fErrors.addElement(new TestFailure(test, t));
for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
((TestListener)e.nextElement()).addError(test, t);
}
|
public synchronized void | addFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)Adds a failure to the list of failures. The passed in exception
caused the failure.
fFailures.addElement(new TestFailure(test, t));
for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
((TestListener)e.nextElement()).addFailure(test, t);
}
|
public synchronized void | addListener(junit.framework.TestListener listener)Registers a TestListener
fListeners.addElement(listener);
|
private synchronized java.util.Vector | cloneListeners()Returns a copy of the listeners.
return (Vector)fListeners.clone();
|
public void | endTest(junit.framework.Test test)Informs the result that a test was completed.
for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
((TestListener)e.nextElement()).endTest(test);
}
|
public synchronized int | errorCount()Gets the number of detected errors.
return fErrors.size();
|
public synchronized java.util.Enumeration | errors()Returns an Enumeration for the errors
return fErrors.elements();
|
public synchronized int | failureCount()Gets the number of detected failures.
return fFailures.size();
|
public synchronized java.util.Enumeration | failures()Returns an Enumeration for the failures
return fFailures.elements();
|
public synchronized void | removeListener(junit.framework.TestListener listener)Unregisters a TestListener
fListeners.removeElement(listener);
|
protected void | run(junit.framework.TestCase test)Runs a TestCase.
startTest(test);
Protectable p= new Protectable() {
public void protect() throws Throwable {
test.runBare();
}
};
runProtected(test, p);
endTest(test);
|
public synchronized int | runCount()Gets the number of run tests.
return fRunTests;
|
public void | runProtected(junit.framework.Test test, junit.framework.Protectable p)Runs a TestCase.
try {
p.protect();
}
catch (AssertionFailedError e) {
addFailure(test, e);
}
catch (ThreadDeath e) { // don't catch ThreadDeath by accident
throw e;
}
catch (Throwable e) {
addError(test, e);
}
|
public synchronized boolean | shouldStop()Checks whether the test run should stop
return fStop;
|
public void | startTest(junit.framework.Test test)Informs the result that a test will be started.
final int count= test.countTestCases();
synchronized(this) {
fRunTests+= count;
}
for (Enumeration e= cloneListeners().elements(); e.hasMoreElements(); ) {
((TestListener)e.nextElement()).startTest(test);
}
|
public synchronized void | stop()Marks that the test run should stop.
fStop= true;
|
public synchronized boolean | wasSuccessful()Returns whether the entire test was successful or not.
return failureCount() == 0 && errorCount() == 0;
|