}
userFriendlyMethodName += ')';
ReportEntry report =
new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ) );
reportManager.testStarting( report );
try
{
setUpFixture();
}
catch ( Throwable e )
{
report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
e ) );
reportManager.testFailed( report );
// A return value of true indicates to this class's executeTestMethods
// method that it should abort and not attempt to execute
// any other test methods. The other caller of this method,
// TestRerunner.rerun, ignores this return value, because it is
// only running one test.
return true;
}
// Make sure that tearDownFixture
try
{
method.invoke( testObject, args );
report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ) );
reportManager.testSucceeded( report );
}
catch ( InvocationTargetException ite )
{
Throwable t = ite.getTargetException();
report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
t ) );
reportManager.testFailed( report );
// Don't return here, because tearDownFixture should be called even
// if the test method throws an exception.
}
catch ( Throwable t )
{
report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
t ) );
reportManager.testFailed( report );
// Don't return here, because tearDownFixture should be called even
// if the test method throws an exception.
}
try
{
tearDownFixture();
}
catch ( Throwable t )
{
// Treat any exception from tearDownFixture as a failure of the test.
report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
t ) );
reportManager.testFailed( report );