Search in sources :

Example 36 with TestResult

use of junit.framework.TestResult in project tomee by apache.

the class TestRunner method start.

public TestResult start(final String[] args) throws Exception {
    TestResult result = null;
    try {
        TestManager.init(null);
        TestManager.start();
    } catch (final Exception e) {
        System.out.println("Cannot initialize the test environment: " + e.getClass().getName() + " " + e.getMessage());
        e.printStackTrace();
        // System.exit(-1);
        throw e;
    }
    try {
        result = super.start(args);
    } catch (final Exception ex) {
    } finally {
        try {
            TestManager.stop();
        } catch (final Exception e) {
            // ignore it
            ;
        }
    }
    // System.exit(0);
    return result;
}
Also used : TestResult(junit.framework.TestResult)

Example 37 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class SuiteTest method ensureSuitesWorkWithForwardCompatibility.

@Test
public void ensureSuitesWorkWithForwardCompatibility() {
    junit.framework.Test test = new JUnit4TestAdapter(All.class);
    TestResult result = new TestResult();
    test.run(result);
    assertEquals(2, result.runCount());
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter) Test(org.junit.Test)

Example 38 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class ForwardCompatibilityTest method testNoException.

public void testNoException() {
    TestResult result = new TestResult();
    junit.framework.Test adapter = new JUnit4TestAdapter(NoExceptionTest.class);
    adapter.run(result);
    assertFalse(result.wasSuccessful());
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Example 39 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class ForwardCompatibilityTest method testExceptionInBefore.

public void testExceptionInBefore() {
    TestResult result = new TestResult();
    junit.framework.Test adapter = new JUnit4TestAdapter(ExceptionInBeforeTest.class);
    adapter.run(result);
    assertEquals(1, result.errorCount());
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Example 40 with TestResult

use of junit.framework.TestResult in project junit4 by junit-team.

the class ForwardCompatibilityTest method testException.

public void testException() {
    TestResult result = new TestResult();
    junit.framework.Test adapter = new JUnit4TestAdapter(ErrorTest.class);
    adapter.run(result);
    assertEquals(exception, result.errors().nextElement().thrownException());
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Aggregations

TestResult (junit.framework.TestResult)108 TestSuite (junit.framework.TestSuite)33 Test (junit.framework.Test)19 JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)17 TestCase (junit.framework.TestCase)14 TestFailure (junit.framework.TestFailure)12 Test (org.junit.Test)10 TestListener (junit.framework.TestListener)9 ArrayList (java.util.ArrayList)8 PrintStream (java.io.PrintStream)7 RepeatedTest (junit.extensions.RepeatedTest)7 Enumeration (java.util.Enumeration)6 Bundle (android.os.Bundle)5 HandlerThread (android.os.HandlerThread)5 ShellUiAutomatorBridge (com.android.uiautomator.core.ShellUiAutomatorBridge)5 Tracer (com.android.uiautomator.core.Tracer)5 UiAutomationShellWrapper (com.android.uiautomator.core.UiAutomationShellWrapper)5 AssertionFailedError (junit.framework.AssertionFailedError)5 IOException (java.io.IOException)4 Iterator (java.util.Iterator)4