Search in sources :

Example 96 with JUnitCore

use of org.junit.runner.JUnitCore in project h2o-3 by h2oai.

the class H2OTestRunner method run.

public Result run(String[] args) throws Exception {
    // List all classes - adapted from JUnitCore code
    List<Class<?>> classes = new ArrayList<Class<?>>();
    List<Failure> missingClasses = new ArrayList<Failure>();
    for (String arg : args) {
        try {
            classes.add(Class.forName(arg));
        } catch (ClassNotFoundException e) {
            Description description = Description.createSuiteDescription(arg);
            Failure failure = new Failure(description, e);
            missingClasses.add(failure);
        }
    }
    // Create standard JUnitCore
    JUnitCore jcore = new JUnitCore();
    // Create default "system"
    JUnitSystem jsystem = new RealSystem();
    // Setup default listener
    jcore.addListener(new TextListener(jsystem));
    // Add XML generator listener
    jcore.addListener(new XMLTestReporter());
    Result result = jcore.run(classes.toArray(new Class[0]));
    for (Failure each : missingClasses) {
        System.err.println("FAIL Missing class in H2OTestRunner: " + each);
        result.getFailures().add(each);
    }
    return result;
}
Also used : Description(org.junit.runner.Description) JUnitCore(org.junit.runner.JUnitCore) ArrayList(java.util.ArrayList) JUnitSystem(org.junit.internal.JUnitSystem) TextListener(org.junit.internal.TextListener) Result(org.junit.runner.Result) RealSystem(org.junit.internal.RealSystem) Failure(org.junit.runner.notification.Failure)

Example 97 with JUnitCore

use of org.junit.runner.JUnitCore in project jna by java-native-access.

the class WininetTest method main.

public static void main(String[] args) {
    JUnitCore jUnitCore = new JUnitCore();
    jUnitCore.run(WininetTest.class);
}
Also used : JUnitCore(org.junit.runner.JUnitCore)

Example 98 with JUnitCore

use of org.junit.runner.JUnitCore in project jna by java-native-access.

the class WininetUtilTest method main.

public static void main(String[] args) {
    JUnitCore jUnitCore = new JUnitCore();
    jUnitCore.run(WininetUtilTest.class);
}
Also used : JUnitCore(org.junit.runner.JUnitCore)

Example 99 with JUnitCore

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

the class ExpectedExceptionTest method runTestAndVerifyResult.

@Test
public void runTestAndVerifyResult() {
    EventCollector collector = new EventCollector();
    JUnitCore core = new JUnitCore();
    core.addListener(collector);
    core.run(classUnderTest);
    assertThat(collector, matcher);
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Test(org.junit.Test)

Example 100 with JUnitCore

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

the class CategoriesAndParameterizedTest method doesNotRunTestsWithoutCategory.

@Test
public void doesNotRunTestsWithoutCategory() {
    Result result = new JUnitCore().run(SuiteWithParameterizedTestWithoutCategory.class);
    assertEquals(1, result.getRunCount());
    assertEquals(0, result.getFailureCount());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Result(org.junit.runner.Result) Test(org.junit.Test)

Aggregations

JUnitCore (org.junit.runner.JUnitCore)169 Result (org.junit.runner.Result)100 Test (org.junit.Test)88 Request (org.junit.runner.Request)32 PrintableResult.testResult (org.junit.experimental.results.PrintableResult.testResult)22 Failure (org.junit.runner.notification.Failure)21 Description (org.junit.runner.Description)16 RunListener (org.junit.runner.notification.RunListener)16 TestResult (junit.framework.TestResult)14 ArrayList (java.util.ArrayList)13 TextListener (org.junit.internal.TextListener)12 Runner (org.junit.runner.Runner)9 RandomizedRunner (com.carrotsearch.randomizedtesting.RandomizedRunner)7 TestSuiteModel (com.google.testing.junit.runner.model.TestSuiteModel)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 OutputStream (java.io.OutputStream)5 CategoryFilter (org.junit.experimental.categories.Categories.CategoryFilter)5 File (java.io.File)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 InOrder (org.mockito.InOrder)4