Search in sources :

Example 51 with Result

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

the class MultiCategoryTest method runSuite.

/**
     * This test is mentioned in {@code Categories} and any changes
     * must be reflected.
     */
@Test
public void runSuite() {
    // Targeting Test:
    Result testResult = JUnitCore.runClasses(MultiCategorySuite.class);
    assertThat("unexpected run count", testResult.getRunCount(), is(equalTo(2)));
    assertThat("unexpected failure count", testResult.getFailureCount(), is(equalTo(0)));
    assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 52 with Result

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

the class MultiCategoryTest method inheritanceAnyAll.

@Test
public void inheritanceAnyAll() {
    //any included, all excluded
    Result testResult = JUnitCore.runClasses(InheritanceAnyAll.class);
    assertThat("unexpected run count", testResult.getRunCount(), is(equalTo(3)));
    assertThat("unexpected failure count", testResult.getFailureCount(), is(equalTo(0)));
    assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 53 with Result

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

the class MultiCategoryTest method inheritanceAnyIncluded.

@Test
public void inheritanceAnyIncluded() {
    Result testResult = JUnitCore.runClasses(InheritanceAny.class);
    assertThat("unexpected run count", testResult.getRunCount(), is(equalTo(3)));
    assertThat("unexpected failure count", testResult.getFailureCount(), is(equalTo(0)));
    assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 54 with Result

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

the class AssumingInTheoriesTest method theoryMeansOnlyAssumeShouldFail.

@Test
public void theoryMeansOnlyAssumeShouldFail() throws InitializationError {
    Result result = runTheoryClass(TheoryWithNoUnassumedParameters.class);
    Assert.assertEquals(1, result.getFailureCount());
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 55 with Result

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

the class ParentRunnerTest method assertClassHasFailureMessage.

private void assertClassHasFailureMessage(Class<?> klass, String message) {
    JUnitCore junitCore = new JUnitCore();
    Request request = Request.aClass(klass);
    Result result = junitCore.run(request);
    assertThat(result.getFailureCount(), is(1));
    assertThat(result.getFailures().get(0).getMessage(), containsString(message));
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Request(org.junit.runner.Request) Result(org.junit.runner.Result)

Aggregations

Result (org.junit.runner.Result)343 Test (org.junit.Test)267 JUnitCore (org.junit.runner.JUnitCore)104 Failure (org.junit.runner.notification.Failure)93 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)23 TestResult (junit.framework.TestResult)21 RunListener (org.junit.runner.notification.RunListener)18 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)8 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