SystemOutTestRunner runner = new SystemOutTestRunner();
return runner.doRun(test);
}
public TestResult doRun(Test suite) {
TestResult result= new TestResult();
result.addListener(this);
suite.run(result);
// Tests Result
StringBuffer strBuf = new StringBuffer();
if (result.failureCount() == 0 && result.errorCount() == 0) {
// all tests OK
strBuf.append("OK");
strBuf.append("\n");
strBuf.append("Tests:" + suite.countTestCases());
System.out.println(strBuf.toString());
}
else {
// report failure and error
strBuf.append("Tests: " + suite.countTestCases() + " ");
strBuf.append("Failures: " + result.failureCount() + " ");
strBuf.append("Errors: " + result.errorCount() + " ");
System.out.println(strBuf.toString());
}
return result;
}