Package org.junit.runner

Examples of org.junit.runner.Result


    @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());
    }
View Full Code Here


        }
    }

    @Test
    public void noIncludeCategoryAnnotation() {
        Result testResult= JUnitCore.runClasses(NoIncludeCategoryAnnotationSuite.class);
        assertTrue(testResult.wasSuccessful());
        assertEquals(1, testResult.getRunCount());
    }
View Full Code Here

    public static class SameAsNoIncludeCategoryAnnotationSuite {
    }

    @Test
    public void sameAsNoIncludeCategoryAnnotation() {
        Result testResult= JUnitCore.runClasses(SameAsNoIncludeCategoryAnnotationSuite.class);
        assertTrue(testResult.wasSuccessful());
        assertEquals(1, testResult.getRunCount());
    }
View Full Code Here

    public void testCountClassFiltering() throws Exception {
        JUnitCore junitCore = new JUnitCore();
        Request request = Request.aClass(ExampleTest.class);
        CountingFilter countingFilter = new CountingFilter();
        Request requestFiltered = request.filterWith(countingFilter);
        Result result = junitCore.run(requestFiltered);
        assertEquals(1, result.getRunCount());
        assertEquals(0, result.getFailureCount());

        Description desc = createTestDescription(ExampleTest.class, "test1");
        assertEquals(1, countingFilter.getCount(desc));
    }
View Full Code Here

        JUnitCore junitCore = new JUnitCore();
        Request request = Request.aClass(suiteClazz);
        CountingFilter countingFilter = new CountingFilter();
        Request requestFiltered = request.filterWith(countingFilter);
        Result result = junitCore.run(requestFiltered);
        assertEquals(1, result.getRunCount());
        assertEquals(0, result.getFailureCount());

        Description suiteDesc = createSuiteDescription(clazz);
        assertEquals(1, countingFilter.getCount(suiteDesc));

        Description desc = createTestDescription(ExampleTest.class, "test1");
View Full Code Here

        fSynchronizer = new CountDownLatch(2);
    }

    @Test
    public void testsRunInParallel() {
        Result result = JUnitCore.runClasses(ParallelComputer.classes(), Example1.class, Example2.class);
        assertTrue(result.wasSuccessful());
        assertNotNull(fExample1One);
        assertNotNull(fExample1Two);
        assertNotNull(fExample2One);
        assertNotNull(fExample2Two);
        assertThat(fExample1One, is(fExample1Two));
View Full Code Here

import org.junit.runner.notification.RunNotifier;

public class OldTestClassAdaptingListenerTest {
    @Test
    public void addFailureDelegatesToNotifier() {
        Result result = new Result();
        RunListener listener = result.createListener();
        RunNotifier notifier = new RunNotifier();
        notifier.addFirstListener(listener);
        TestCase testCase = new TestCase() {
        };
        TestListener adaptingListener = new JUnit38ClassRunner(testCase)
                .createAdaptingListener(notifier);
        adaptingListener.addFailure(testCase, new AssertionFailedError());
        assertEquals(1, result.getFailureCount());
    }
View Full Code Here

    }

    @Test
    public void ensureTestsAreRun() {
        JUnitCore core = new JUnitCore();
        Result result = core.run(AllWithMySuite.class);
        assertEquals(2, result.getRunCount());
        assertEquals(1, result.getFailureCount());
    }
View Full Code Here

    public static class Sub extends Super {
    }

    @Test
    public void subclassWithOnlyInheritedTestsRuns() {
        Result result = JUnitCore.runClasses(Sub.class);
        assertTrue(result.wasSuccessful());
    }
View Full Code Here

     * 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)));
    }
View Full Code Here

TOP

Related Classes of org.junit.runner.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.