Methods Summary |
---|
protected junit.framework.TestResult | createTestResult()
return new TestResult();
|
public static void | main(java.lang.String[] args)Provides the main entry point. First and second argument are class and
method name, respectively. Third argument is the temporary file name for
the result. Exits with one of the usual JUnit exit values.
Logger.global.setLevel(Level.OFF);
CoreTestIsolator testRunner = new CoreTestIsolator();
try {
TestResult r = testRunner.start(args);
if (!r.wasSuccessful()) {
// Store failure or error - we know there must be one
Throwable failure = r.failureCount() != 0 ?
((TestFailure)r.failures().nextElement()).
thrownException() :
((TestFailure)r.errors().nextElement()).
thrownException();
saveStackTrace(failure, args[2]);
System.exit(FAILURE_EXIT);
} else {
// Nothing to see here, please get along
System.exit(SUCCESS_EXIT);
}
} catch(Exception e) {
// Let main TestRunner know about execution problem
saveStackTrace(e, args[2]);
System.exit(EXCEPTION_EXIT);
}
|
private static void | saveStackTrace(java.lang.Throwable throwable, java.lang.String fileName)Saves a given stack trace to a given file.
try {
FileOutputStream fos = new FileOutputStream(fileName);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(throwable);
oos.flush();
oos.close();
} catch (IOException ex) {
// Ignore
}
|
protected junit.framework.TestResult | start(java.lang.String[] args)
try {
Test suite = TestSuite.createTest(Class.forName(args[0]), args[1]);
return doRun(suite);
}
catch(Exception e) {
throw new RuntimeException("Unable to launch test", e);
}
|