Code example for TestResult

Methods: failureCountrunCountwasSuccessful

0
//		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());
	} 
	public void testNotExistingTestCase() { 
		Test t= new SuiteTest("notExistingMethod");
		t.run(fResult);
		assertTrue(fResult.runCount() == 1);  
		assertTrue(fResult.failureCount() == 1);
		assertTrue(fResult.errorCount() == 0);
	} 
	public void testNotPublicTestCase() { 
		TestSuite suite= new TestSuite(NotPublicTestCase.class);
		// 1 public test case + 1 warning for the non-public test case 
Connect your IDE to all the code out there  Get Codota for Java