Package org.junit.runner

Examples of org.junit.runner.Result$SerializedForm


    private Result runTest(Class<?> testClass) {
        return JUnitCore.runClasses(testClass);
    }

    private void assertTestFails(Class<?> testClass, String message) {
        Result result = runTest(testClass);

        boolean isInitializationError = false;

        for (Failure failure : result.getFailures()) {
            isInitializationError = isInitializationError || failure.getException().getMessage().equals(message);
        }

        Assert.assertEquals(true, isInitializationError);
    }
View Full Code Here


    for (Description mod : desc.getChildren()) {
      TestEvaluator runner = new TestEvaluator(evaluator, new Listener(notifier, mod));
      runner.test(mod.getDisplayName());
    }
   
    notifier.fireTestRunFinished(new Result());
  }
View Full Code Here

      }
    }
 
    @Override
    public void done() {
      notifier.fireTestRunFinished(new Result());
    }
View Full Code Here

import org.junit.runner.Result;
import org.junit.runner.notification.Failure;

public class MyTestRunner {
  public static void main(String[] args) {
    Result result = JUnitCore.runClasses(FizzBuzzCounterTest.class);
    for (Failure failure : result.getFailures()) {
      System.out.println(failure.toString());
    }
  }
View Full Code Here

        }
    }

    @Test
    public void ignoreNonRules() {
        Result result = JUnitCore.runClasses(NoRulesTest.class);
        assertEquals(0, result.getFailureCount());
    }
View Full Code Here

    }

    @Test
    public void onFailure() {
        log = "";
        Result result = JUnitCore.runClasses(OnFailureTest.class);
        assertEquals("nothing AssertionError", log);
        assertEquals(1, result.getFailureCount());
    }
View Full Code Here

    }

    @Test
    public void testsAreOnlyIncludedOnceWhenExpandingForSorting()
            throws Exception {
        Result result = fMax.run(Request.aClass(TwoTests.class));
        assertEquals(2, result.getRunCount());
    }
View Full Code Here

        }
    }

    @Test
    public void junit3TestsAreRunOnce() throws Exception {
        Result result = fMax.run(Request.aClass(TwoOldTests.class),
                new JUnitCore());
        assertEquals(2, result.getRunCount());
    }
View Full Code Here

    public void correctErrorFromMalformedTest() {
        Request request = Request.aClass(MalformedJUnit38TestMethod.class);
        JUnitCore core = new JUnitCore();
        Request sorted = fMax.sortRequest(request);
        Runner runner = sorted.getRunner();
        Result result = core.run(runner);
        Failure failure = result.getFailures().get(0);
        assertThat(failure.toString(), containsString("MalformedJUnit38TestMethod"));
        assertThat(failure.toString(), containsString("testNothing"));
        assertThat(failure.toString(), containsString("isn't public"));
    }
View Full Code Here

    public void correctErrorFromHalfMalformedTest() {
        Request request = Request.aClass(HalfMalformedJUnit38TestMethod.class);
        JUnitCore core = new JUnitCore();
        Request sorted = fMax.sortRequest(request);
        Runner runner = sorted.getRunner();
        Result result = core.run(runner);
        Failure failure = result.getFailures().get(0);
        assertThat(failure.toString(), containsString("MalformedJUnit38TestMethod"));
        assertThat(failure.toString(), containsString("testNothing"));
        assertThat(failure.toString(), containsString("isn't public"));
    }
View Full Code Here

TOP

Related Classes of org.junit.runner.Result$SerializedForm

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.