Package junit.framework

Examples of junit.framework.TestResult.errorCount()


        TestResult testResult = new TestResult();

        AntUnitTestCase antUnitTestCase = new AntUnitTestCase(nameForInvalidF);
        antUnitTestCase.run(testResult);

        assertEquals(1 , testResult.errorCount());
        TestFailure error = (TestFailure) testResult.errors().nextElement();
        assertSame(antUnitTestCase, error.failedTest());
        assertTrue("Unexpected error : " + error.exceptionMessage(),
                error.exceptionMessage().contains("invalidFile"));
    }
View Full Code Here


        suite = new AntUnitSuite(new File("xxxx"), AntUnitSuiteTest.class);
        TestResult testResult = new TestResult();
        suite.run(testResult);
       
        assertNotNull(suite.getName());
        assertEquals(1 , testResult.errorCount());
        TestFailure error = (TestFailure) testResult.errors().nextElement();
        assertTrue("Unexpected error : " + error.exceptionMessage(),
                error.exceptionMessage().contains("xxxx"));
    }
   
View Full Code Here

       
        TestResultBean resultBean = new TestResultBean();
       
        final int runCount = result.runCount();
        final int failureCount = result.failureCount();
        final int errorCount = result.errorCount();
       
        resultBean.setRunCount(runCount);
        resultBean.setFailureCount(failureCount);
        resultBean.setErrorCount(errorCount);
       
View Full Code Here

        return;
    }
    final Test suite = suite();
    for (int i = 0; i < count || count == -1; i++) {
      TestResult run = junit.textui.TestRunner.run(suite);
      if (!keepRunning && (run.errorCount() + run.failureCount()) > 0) {
        System.exit(-1);
      }
    }
  }
}
View Full Code Here

         ExpiryRunnerTest expiryRunnerTest = new ExpiryRunnerTest();
         expiryRunnerTest.setName("testExpireWhilstConsuming");
         suite.addTest(expiryRunnerTest);

         TestResult result = TestRunner.run(suite);
         if (result.errorCount() > 0 || result.failureCount() > 0)
         {
            System.exit(1);
         }
      }
   }
View Full Code Here

            if (result.failureCount() != 0) {
                Enumeration e = result.failures();
                Throwable t = ((TestFailure)e.nextElement()).thrownException();
                t.printStackTrace(new PrintStream(os));
            }
            else if (result.errorCount() != 0) {
                Enumeration e = result.errors();
                Throwable t = ((TestFailure)e.nextElement()).thrownException();
                t.printStackTrace(new PrintStream(os));
            }
            // NOTE: System.exit with non-zero status causes an error dialog
View Full Code Here

         ExpiryRunnerTest expiryRunnerTest = new ExpiryRunnerTest();
         expiryRunnerTest.setName("testExpireWhilstConsuming");
         suite.addTest(expiryRunnerTest);

         TestResult result = TestRunner.run(suite);
         if (result.errorCount() > 0 || result.failureCount() > 0)
         {
            System.exit(1);
         }
      }
   }
View Full Code Here

  }

  @Test public void compatibility() {
    TestResult result= new TestResult();
    new JUnit4TestAdapter(InfiniteLoopTest.class).run(result);
    assertEquals(1, result.errorCount());
  }
 
  public static class WillTimeOut {
    static boolean afterWasCalled= false;
   
View Full Code Here

 
  public void testExceptionInBefore() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(ExceptionInBeforeTest.class);
    adapter.run(result);
    assertEquals(1, result.errorCount());
  }
 
  public static class InvalidMethodTest {
    @BeforeClass public void shouldBeStatic() {}
    @Test public void aTest() {}
View Full Code Here

 
  public void testInvalidMethod() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(InvalidMethodTest.class);
    adapter.run(result);
    assertEquals(1, result.errorCount())
    TestFailure failure= result.errors().nextElement();
    assertTrue(failure.exceptionMessage().contains("Method shouldBeStatic() should be static"));
  }
 
  private static boolean wasRun= false;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.