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);
}
}
}
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;
}
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);
}
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);
}
}
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);
}
Aggregations