Search in sources :

Example 91 with JUnitCore

use of org.junit.runner.JUnitCore in project junit4 by junit-team.

the class ExpectedExceptionTest method runTestAndVerifyResult.

@Test
public void runTestAndVerifyResult() {
    EventCollector collector = new EventCollector();
    JUnitCore core = new JUnitCore();
    core.addListener(collector);
    core.run(classUnderTest);
    assertThat(collector, matcher);
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Test(org.junit.Test)

Example 92 with JUnitCore

use of org.junit.runner.JUnitCore in project junit4 by junit-team.

the class CategoriesAndParameterizedTest method doesNotRunTestsWithoutCategory.

@Test
public void doesNotRunTestsWithoutCategory() {
    Result result = new JUnitCore().run(SuiteWithParameterizedTestWithoutCategory.class);
    assertEquals(1, result.getRunCount());
    assertEquals(0, result.getFailureCount());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 93 with JUnitCore

use of org.junit.runner.JUnitCore in project junit4 by junit-team.

the class CategoriesAndParameterizedTest method runsTestsWithoutCategory.

@Test
public void runsTestsWithoutCategory() {
    Result result = new JUnitCore().run(SuiteWithParameterizedTestWithCategory.class);
    assertEquals(2, result.getRunCount());
    assertEquals(0, result.getFailureCount());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 94 with JUnitCore

use of org.junit.runner.JUnitCore in project junit4 by junit-team.

the class CategoryTest method testCountWithExplicitExcludeFilter_usingConstructor.

@Test
public void testCountWithExplicitExcludeFilter_usingConstructor() throws Throwable {
    CategoryFilter include = new CategoryFilter(null, SlowTests.class);
    Request baseRequest = Request.aClass(TestSuiteWithNoCategories.class);
    Result result = new JUnitCore().run(baseRequest.filterWith(include));
    assertEquals(2, result.getFailureCount());
    assertEquals(2, result.getRunCount());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Request(org.junit.runner.Request) CategoryFilter(org.junit.experimental.categories.Categories.CategoryFilter) Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Example 95 with JUnitCore

use of org.junit.runner.JUnitCore in project junit4 by junit-team.

the class CategoryTest method testCountWithMultipleIncludeFilter.

@Test
public void testCountWithMultipleIncludeFilter() throws Throwable {
    CategoryFilter exclude = CategoryFilter.include(true, SlowTests.class, FastTests.class);
    Request baseRequest = Request.aClass(OneOfEach.class);
    Result result = new JUnitCore().run(baseRequest.filterWith(exclude));
    assertTrue(result.wasSuccessful());
    assertEquals(2, result.getRunCount());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Request(org.junit.runner.Request) CategoryFilter(org.junit.experimental.categories.Categories.CategoryFilter) Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Aggregations

JUnitCore (org.junit.runner.JUnitCore)173 Result (org.junit.runner.Result)104 Test (org.junit.Test)88 Request (org.junit.runner.Request)33 Failure (org.junit.runner.notification.Failure)24 PrintableResult.testResult (org.junit.experimental.results.PrintableResult.testResult)22 RunListener (org.junit.runner.notification.RunListener)17 Description (org.junit.runner.Description)16 ArrayList (java.util.ArrayList)14 TestResult (junit.framework.TestResult)14 TextListener (org.junit.internal.TextListener)12 Runner (org.junit.runner.Runner)9 RandomizedRunner (com.carrotsearch.randomizedtesting.RandomizedRunner)7 TestSuiteModel (com.google.testing.junit.runner.model.TestSuiteModel)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 OutputStream (java.io.OutputStream)5 CategoryFilter (org.junit.experimental.categories.Categories.CategoryFilter)5 File (java.io.File)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 InOrder (org.mockito.InOrder)4