Search in sources :

Example 6 with Result

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

the class MethodRulesTest method ignoreNonRules.

@Test
public void ignoreNonRules() {
    Result result = JUnitCore.runClasses(NoRulesTest.class);
    assertEquals(0, result.getFailureCount());
}
Also used : Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Example 7 with Result

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

the class CategoryTest method oneRunnableOthersAvoided.

@Test
public void oneRunnableOthersAvoided() {
    Result result = JUnitCore.runClasses(IncludedExcludedSameSuite.class);
    assertEquals(1, result.getRunCount());
    assertTrue(result.wasSuccessful());
}
Also used : Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Example 8 with Result

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

the class CategoryTest method testCountWithMultipleExcludeFilter.

@Test
@SuppressWarnings("unchecked")
public void testCountWithMultipleExcludeFilter() throws Throwable {
    Set<Class<?>> exclusions = new HashSet<Class<?>>(2);
    Collections.addAll(exclusions, SlowTests.class, FastTests.class);
    CategoryFilter exclude = CategoryFilter.categoryFilter(true, null, true, exclusions);
    Request baseRequest = Request.aClass(OneOfEach.class);
    Result result = new JUnitCore().run(baseRequest.filterWith(exclude));
    assertTrue(result.wasSuccessful());
    assertEquals(1, result.getRunCount());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Request(org.junit.runner.Request) HashSet(java.util.HashSet) 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 9 with Result

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

the class CategoryTest method testCountOnAWithoutSlowTests.

@Test
public void testCountOnAWithoutSlowTests() {
    Result result = JUnitCore.runClasses(SomeAreSlowSuite.class);
    assertThat(testResult(SomeAreSlowSuite.class), isSuccessful());
    assertEquals(2, result.getRunCount());
    assertTrue(result.wasSuccessful());
}
Also used : Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Example 10 with Result

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

the class CategoryTest method testCountWithExplicitIncludeFilter.

@Test
public void testCountWithExplicitIncludeFilter() throws Throwable {
    CategoryFilter include = CategoryFilter.include(SlowTests.class);
    Request baseRequest = Request.aClass(TestSuiteWithNoCategories.class);
    Result result = new JUnitCore().run(baseRequest.filterWith(include));
    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

Result (org.junit.runner.Result)337 Test (org.junit.Test)267 JUnitCore (org.junit.runner.JUnitCore)100 Failure (org.junit.runner.notification.Failure)90 PrintableResult.testResult (org.junit.experimental.results.PrintableResult.testResult)61 UnitTest (org.apache.geode.test.junit.categories.UnitTest)56 Description (org.junit.runner.Description)28 Request (org.junit.runner.Request)22 TestResult (junit.framework.TestResult)21 RunListener (org.junit.runner.notification.RunListener)17 IOException (java.io.IOException)12 SettableCurrentRunningTest (com.google.testing.junit.runner.internal.junit4.SettableCurrentRunningTest)11 CurrentRunningTest (com.google.testing.junit.runner.util.CurrentRunningTest)11 JUnit4TestListener (com.intellij.junit4.JUnit4TestListener)9 ArrayList (java.util.ArrayList)7 Runner (org.junit.runner.Runner)7 ComparisonFailure (org.junit.ComparisonFailure)6 CategoryFilter (org.junit.experimental.categories.Categories.CategoryFilter)5 TextListener (org.junit.internal.TextListener)5 ShardingEnvironment (com.google.testing.junit.runner.sharding.ShardingEnvironment)4