Search in sources :

Example 51 with TestResult

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

the class TestRunner method main.

/**
 * main entry point.
 */
public static void main(final String[] args) {
    if (args.length == 0) {
        printHelp();
    } else {
        if (args[0].equals("--help")) {
            printHelp();
            return;
        } else if (args[0].equals("local")) {
            runLocalTests();
        } else if (args[0].equals("remote")) {
            runRemoteTests();
        } else if (args[0].equals("http")) {
            runRemoteHttpTests();
        } else if (args[0].equals("tomcat")) {
            runTomcatRemoteHttpTests();
        } else {
            printHelp();
            return;
        }
        try {
            final TestRunner aTestRunner = new TestRunner();
            final TestResult r = aTestRunner.start(new String[] { "org.apache.openejb.test.ClientTestSuite" });
            System.out.println("");
            System.out.println("_________________________________________________");
            System.out.println("CLIENT JNDI PROPERTIES");
            final Properties env = TestManager.getServer().getContextEnvironment();
            for (final Iterator iterator = env.entrySet().iterator(); iterator.hasNext(); ) {
                final Map.Entry entry = (Map.Entry) iterator.next();
                final String key = (String) entry.getKey();
                final Object value = entry.getValue();
                System.out.println(key + " = " + value);
            }
            System.out.println("_________________________________________________");
            if (!r.wasSuccessful())
                System.exit(FAILURE_EXIT);
            System.exit(SUCCESS_EXIT);
        } catch (final Exception e) {
            System.err.println(e.getMessage());
            System.exit(EXCEPTION_EXIT);
        }
    }
}
Also used : Iterator(java.util.Iterator) TestResult(junit.framework.TestResult) Properties(java.util.Properties) Map(java.util.Map)

Example 52 with TestResult

use of junit.framework.TestResult in project jna by java-native-access.

the class WebStartTest method runTestCaseTest.

private static Throwable runTestCaseTest(String testClass, String method, int port) throws Exception {
    TestCase test = (TestCase) Class.forName(testClass).newInstance();
    test.setName(method);
    TestResult result = new TestResult();
    test.run(result);
    if (result.failureCount() != 0) {
        Enumeration<TestFailure> e = result.failures();
        return e.nextElement().thrownException();
    } else if (result.errorCount() != 0) {
        Enumeration<TestFailure> e = result.errors();
        return e.nextElement().thrownException();
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) TestCase(junit.framework.TestCase) TestFailure(junit.framework.TestFailure) TestResult(junit.framework.TestResult)

Example 53 with TestResult

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

the class JUnit38ClassRunner method run.

@Override
public void run(RunNotifier notifier) {
    TestResult result = new TestResult();
    result.addListener(createAdaptingListener(notifier));
    getTest().run(result);
}
Also used : TestResult(junit.framework.TestResult)

Example 54 with TestResult

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

the class TestRunner method main.

public static void main(String[] args) {
    TestRunner aTestRunner = new TestRunner();
    try {
        TestResult r = aTestRunner.start(args);
        if (!r.wasSuccessful()) {
            System.exit(FAILURE_EXIT);
        }
        System.exit(SUCCESS_EXIT);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        System.exit(EXCEPTION_EXIT);
    }
}
Also used : BaseTestRunner(junit.runner.BaseTestRunner) TestResult(junit.framework.TestResult)

Example 55 with TestResult

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

the class TestCaseTest method verifyFailure.

void verifyFailure(TestCase test) {
    TestResult result = test.run();
    assertTrue(result.runCount() == 1);
    assertTrue(result.failureCount() == 1);
    assertTrue(result.errorCount() == 0);
}
Also used : TestResult(junit.framework.TestResult)

Aggregations

TestResult (junit.framework.TestResult)80 TestSuite (junit.framework.TestSuite)25 JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)15 TestCase (junit.framework.TestCase)13 Test (junit.framework.Test)11 TestFailure (junit.framework.TestFailure)8 RepeatedTest (junit.extensions.RepeatedTest)7 TestListener (junit.framework.TestListener)7 Test (org.junit.Test)7 PrintStream (java.io.PrintStream)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 ResultPrinter (junit.textui.ResultPrinter)4 Enumeration (java.util.Enumeration)3 TestSetup (junit.extensions.TestSetup)3 AssertionFailedError (junit.framework.AssertionFailedError)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2