Search in sources :

Example 91 with Result

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

the class StopwatchTest method succeeded.

@Test
public void succeeded() {
    Result result = runTest(SuccessfulTest.class);
    assertEquals(0, result.getFailureCount());
    assertThat(record.name, is("successfulTest"));
    assertThat(record.name, is(finishedRecord.name));
    assertThat(record.status, is(TestStatus.SUCCEEDED));
    assertTrue("timeSpent > 0", record.duration > 0);
    assertThat(record.duration, is(finishedRecord.duration));
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 92 with Result

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

the class StopwatchTest method skipped.

@Test
public void skipped() {
    Result result = runTest(SkippedTest.class);
    assertEquals(0, result.getFailureCount());
    assertThat(record.name, is("skippedTest"));
    assertThat(record.name, is(finishedRecord.name));
    assertThat(record.status, is(TestStatus.SKIPPED));
    assertTrue("timeSpent > 0", record.duration > 0);
    assertThat(record.duration, is(finishedRecord.duration));
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 93 with Result

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

the class JUnit4ClassRunnerTest method runWithOldJUnit4ClassRunner.

@Test
public void runWithOldJUnit4ClassRunner() {
    Result result = JUnitCore.runClasses(Example.class);
    assertThat(result.getRunCount(), is(2));
    assertThat(result.getFailureCount(), is(1));
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 94 with Result

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

the class RuleChainTest method whenRuleChainHasNullRuleTheStacktraceShouldPointToIt.

@Test
public void whenRuleChainHasNullRuleTheStacktraceShouldPointToIt() {
    Result result = JUnitCore.runClasses(RuleChainWithNullRules.class);
    assertThat(result.getFailures().size(), equalTo(1));
    String stacktrace = Throwables.getStacktrace(result.getFailures().get(0).getException());
    assertThat(stacktrace, containsString("\tat org.junit.rules.RuleChainTest$RuleChainWithNullRules.<init>(RuleChainTest.java:"));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Example 95 with Result

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

the class AnnotationTest method testRunAllAfterClassesRegardless.

public void testRunAllAfterClassesRegardless() {
    log = "";
    JUnitCore core = new JUnitCore();
    Result result = core.run(RunAllAfterClassesRegardless.class);
    assertTrue(log.contains("one"));
    assertTrue(log.contains("two"));
    assertEquals(2, result.getFailureCount());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult)

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