Package org.junit.runner

Examples of org.junit.runner.JUnitCore.run()


    @Test(expected = Error.class)
    public void failingListener() {
        JUnitCore runner = new JUnitCore();
        runner.addListener(new ErrorListener());
        runner.run(OneTest.class);
    }

    class ExceptionListener extends ErrorListener {
        @Override
        public void testRunStarted(Description description) throws Exception {
View Full Code Here


    public void reportsFailureOfListener() {
        JUnitCore core = new JUnitCore();
        core.addListener(new ExceptionListener());

        count = 0;
        Result result = core.run(OneTest.class);
        assertEquals(1, count);
        assertEquals(1, result.getFailureCount());
        Failure testFailure = result.getFailures().get(0);
        assertEquals(Description.TEST_MECHANISM, testFailure.getDescription());
    }
View Full Code Here

    }

    @Test
    public void freshResultEachTime() {
        JUnitCore core = new JUnitCore();
        Result first = core.run(OneTest.class);
        Result second = core.run(OneTest.class);
        assertNotSame(first, second);
    }
}
View Full Code Here

    @Test
    public void freshResultEachTime() {
        JUnitCore core = new JUnitCore();
        Result first = core.run(OneTest.class);
        Result second = core.run(OneTest.class);
        assertNotSame(first, second);
    }
}
View Full Code Here

    @Ignore("For testing purposes") @Test public void withReason() {}
  }

  @Test public void ignoreRunner() {
    JUnitCore runner= new JUnitCore();
    Result result= runner.run(IgnoredTest.class);
    assertEquals(2, result.getIgnoreCount());
  }

  @Test public void compatibility() {
    TestResult result= new TestResult();
View Full Code Here

  }

  public static void main(String... args) throws InitializationError {
    JUnitCore core = new JUnitCore();
    core.addListener(new TextListener());
    core.run(AllTests.class);
  }
}
View Full Code Here

  }

  @Test public void prerequsitesRunner() {
    JUnitCore core = new JUnitCore();
    Request req = AnnotationHandlingRequest.aClass(APrereqTest.class);
    Result result = core.run(req);
    assertEquals(1+4, result.getRunCount());
    assertEquals(0, result.getFailureCount());
    assertEquals(4, result.getIgnoreCount());
  }
View Full Code Here

  }

  @Test public void prerequsitesRunnerInternalFail() {
    JUnitCore core = new JUnitCore();
    Request req = AnnotationHandlingRequest.aClass(APrereqInternalFailTest.class);
    Result result = core.run(req);
    assertEquals(0, result.getRunCount());
    assertEquals(6, result.getFailureCount());
    assertEquals(0, result.getIgnoreCount());
  }
View Full Code Here

  }
 
  @Test public void prerequisitesRunWithoutRunWith() throws InitializationError {
    JUnitCore core = new JUnitCore();
    Request req = AnnotationHandlingRequest.aClass(APrereqTestWithoutRunWith.class);
    Result result = core.run(req);
    assertEquals(1+1, result.getRunCount());
    assertEquals(0, result.getFailureCount());
    assertEquals(1, result.getIgnoreCount());   
  }
View Full Code Here

  }
 
  @Test public void prerequisitesRunWithRunWith() throws InitializationError {
    JUnitCore core = new JUnitCore();
    Request req = Request.aClass(APrereqTestWithRunWith.class);
    Result result = core.run(req);
    assertEquals(1+1, result.getRunCount());
    assertEquals(0, result.getFailureCount());
    assertEquals(1, result.getIgnoreCount());   
  }
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.