Methods Summary |
---|
public void | addError(junit.framework.Test test, java.lang.Throwable error)A test caused an error.
formatError("\tCaused an ERROR", test, error);
|
public void | addFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)Interface TestListener for JUnit > 3.4.
A Test failed.
addFailure(test, (Throwable) t);
|
public void | addFailure(junit.framework.Test test, java.lang.Throwable t)Interface TestListener for JUnit <= 3.4.
A Test failed.
formatError("\tFAILED", test, t);
|
public void | endTest(junit.framework.Test test)A test ended.
|
public void | endTestSuite(JUnitTest suite)The whole testsuite ended.
StringBuffer sb = new StringBuffer("Tests run: ");
sb.append(suite.runCount());
sb.append(", Failures: ");
sb.append(suite.failureCount());
sb.append(", Errors: ");
sb.append(suite.errorCount());
sb.append(", Time elapsed: ");
sb.append(numberFormat.format(suite.getRunTime() / 1000.0));
sb.append(" sec");
sb.append(StringUtils.LINE_SEP);
sb.append(StringUtils.LINE_SEP);
// append the err and output streams to the log
if (systemOutput != null && systemOutput.length() > 0) {
sb.append("------------- Standard Output ---------------")
.append(StringUtils.LINE_SEP)
.append(systemOutput)
.append("------------- ---------------- ---------------")
.append(StringUtils.LINE_SEP);
}
if (systemError != null && systemError.length() > 0) {
sb.append("------------- Standard Error -----------------")
.append(StringUtils.LINE_SEP)
.append(systemError)
.append("------------- ---------------- ---------------")
.append(StringUtils.LINE_SEP);
}
if (output != null) {
try {
output.write(sb.toString());
resultWriter.close();
output.write(results.toString());
output.flush();
} finally {
if (out != System.out && out != System.err) {
FileUtils.close(out);
}
}
}
|
protected synchronized void | formatError(java.lang.String type, junit.framework.Test test, java.lang.Throwable error)Format an error and print it.
if (test != null) {
endTest(test);
}
resultWriter.println(formatTest(test) + type);
resultWriter.println(error.getMessage());
String strace = JUnitTestRunner.getFilteredTrace(error);
resultWriter.println(strace);
resultWriter.println();
|
protected java.lang.String | formatTest(junit.framework.Test test)Format the test for printing..
if (test == null) {
return "Null Test: ";
} else {
return "Testcase: " + test.toString() + ":";
}
|
public void | setOutput(java.io.OutputStream out)Sets the stream the formatter is supposed to write its results to.
this.out = out;
output = new PrintWriter(out);
|
public void | setSystemError(java.lang.String err){@inheritDoc}.
systemError = err;
|
public void | setSystemOutput(java.lang.String out){@inheritDoc}.
systemOutput = out;
|
public void | startTest(junit.framework.Test test)A test started.
|
public void | startTestSuite(JUnitTest suite)The whole testsuite started.
if (output == null) {
return; // Quick return - no output do nothing.
}
StringBuffer sb = new StringBuffer("Testsuite: ");
sb.append(suite.getName());
sb.append(StringUtils.LINE_SEP);
output.write(sb.toString());
output.flush();
|