Code example for TestResult

Methods: runCount, wasSuccessful

0
		return suite;
	} 
	public void testInheritedTests() { 
		TestSuite suite= new TestSuite(InheritedTestCase.class);
		suite.run(fResult);
		assertTrue(fResult.wasSuccessful());
		assertEquals(2, fResult.runCount());
	} 
// This test case is obsolete, since the compiler will catch this error in 1.5 
//	public void testNoTestCaseClass() { 
//		Test t= new TestSuite(NoTestCaseClass.class); 
//		t.run(fResult); 
//		assertEquals(1, fResult.runCount());  // warning test 
//		assertTrue(! fResult.wasSuccessful()); 
//	} 
	public void testNoTestCases() { 
		Test t= new TestSuite(NoTestCases.class);
		t.run(fResult);
		assertTrue(fResult.runCount() == 1);  // warning test
		assertTrue(fResult.failureCount() == 1);
		assertTrue(! fResult.wasSuccessful());