Search in sources :

Example 76 with Result

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

the class SingleMethodTest method parameterizedFilterToSingleMethod.

@Test
public void parameterizedFilterToSingleMethod() throws Exception {
    count = 0;
    Runner runner = Request.method(ParameterizedOneTimeSetup.class, "one[0]").getRunner();
    Result result = new JUnitCore().run(runner);
    assertEquals(1, result.getRunCount());
}
Also used : Runner(org.junit.runner.Runner) JUnitCore(org.junit.runner.JUnitCore) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 77 with Result

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

the class SingleMethodTest method oneTimeSetup.

@Test
public void oneTimeSetup() throws Exception {
    count = 0;
    Runner runner = Request.method(OneTimeSetup.class, "one").getRunner();
    Result result = new JUnitCore().run(runner);
    assertEquals(1, count);
    assertEquals(1, result.getRunCount());
}
Also used : Runner(org.junit.runner.Runner) JUnitCore(org.junit.runner.JUnitCore) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 78 with Result

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

the class ClassLevelMethodsWithIgnoredTestsTest method beforeClassShouldNotRunWhenAllTestsAreFiltered.

@Test
public void beforeClassShouldNotRunWhenAllTestsAreFiltered() {
    Result result = new JUnitCore().run(Request.classes(BeforeClassWithFilteredTest.class, HasUnfilteredTest.class).filterWith(CategoryFilter.exclude(FilteredTests.class)));
    analyseResult(result, "BeforeClass should not have been executed because the test method is filtered!");
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 79 with Result

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

the class EnclosedTest method enclosedRunnerRunsConcreteEnclosedClasses.

@Test
public void enclosedRunnerRunsConcreteEnclosedClasses() throws Exception {
    Result result = JUnitCore.runClasses(Enclosing.class);
    assertEquals(5, result.getRunCount());
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 80 with Result

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

the class IgnoreClassTest method ignoreClass.

@Test
public void ignoreClass() {
    Result result = JUnitCore.runClasses(IgnoreMe.class);
    assertEquals(0, result.getFailureCount());
    assertEquals(1, result.getIgnoreCount());
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

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