Java Code Examples for junit.framework.TestCase#run()
The following examples show how to use
junit.framework.TestCase#run() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestMerge.java From evosql with Apache License 2.0 | 5 votes |
public static void main(String[] argv) { TestResult result = new TestResult(); TestCase testA = new TestMerge("testMerge1"); TestCase testB = new TestMerge("testMerge2"); TestCase testC = new TestMerge("testMerge3"); TestCase testD = new TestMerge("testMerge4"); TestCase testE = new TestMerge("testMerge5"); TestCase testF = new TestMerge("testMerge6"); TestCase testG = new TestMerge("testMerge7"); TestCase testH = new TestMerge("testMerge8"); TestCase testI = new TestMerge("testMerge9"); testA.run(result); testB.run(result); testC.run(result); testD.run(result); testE.run(result); testF.run(result); testG.run(result); testH.run(result); testI.run(result); System.out.println("TestMerge error count: " + result.failureCount()); Enumeration e = result.failures(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); } }
Example 2
Source File: TestSql.java From evosql with Apache License 2.0 | 5 votes |
public static void main(String[] argv) { TestResult result = new TestResult(); TestCase testA = new TestSql("testMetaData"); TestCase testB = new TestSql("testDoubleNaN"); TestCase testC = new TestSql("testAny"); testA.run(result); testB.run(result); testC.run(result); System.out.println("TestSql error count: " + result.failureCount()); }
Example 3
Source File: TestHTTPKeepAlive.java From evosql with Apache License 2.0 | 5 votes |
public static void main(String[] argv) { TestResult result = new TestResult(); TestCase testKeepAlive = new TestHTTPKeepAlive("testKeepAlive"); testKeepAlive.run(result); System.out.println("TestKeepAlive error count: " + result.failureCount()); Enumeration e = result.failures(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); } }
Example 4
Source File: TestSqlPersistent.java From evosql with Apache License 2.0 | 5 votes |
public static void main(String[] argv) { TestResult result = new TestResult(); TestCase testC = new TestSqlPersistent("testInsertObject"); TestCase testD = new TestSqlPersistent("testSelectObject"); testC.run(result); testD.run(result); System.out.println("TestSqlPersistent error count: " + result.failureCount()); }
Example 5
Source File: TestMultiInsert.java From evosql with Apache License 2.0 | 5 votes |
public static void main(String[] argv) { TestResult result = new TestResult(); TestCase testA = new TestMultiInsert("testMultiInsert"); testA.run(result); System.out.println("TestMultiInsert error count: " + result.failureCount()); Enumeration e = result.failures(); while(e.hasMoreElements()) System.out.println(e.nextElement()); }
Example 6
Source File: TestListenerTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testError() { TestCase test= new TestCase("noop") { public void runTest() { throw new Error(); } }; test.run(fResult); assertEquals(1, fErrorCount); assertEquals(1, fEndCount); }
Example 7
Source File: TestListenerTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testFailure() { TestCase test= new TestCase("noop") { public void runTest() { fail(); } }; test.run(fResult); assertEquals(1, fFailureCount); assertEquals(1, fEndCount); }
Example 8
Source File: TestListenerTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testStartStop() { TestCase test= new TestCase("noop") { public void runTest() { } }; test.run(fResult); assertEquals(1, fStartCount); assertEquals(1, fEndCount); }
Example 9
Source File: TestCaseTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testNamelessTestCase() { TestCase t= new TestCase() {}; try { t.run(); fail(); } catch (AssertionFailedError e) { } }
Example 10
Source File: TestCaseTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
void verifyError(TestCase test) { TestResult result= test.run(); assertTrue(result.runCount() == 1); assertTrue(result.failureCount() == 0); assertTrue(result.errorCount() == 1); }
Example 11
Source File: TestCaseTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
void verifyFailure(TestCase test) { TestResult result= test.run(); assertTrue(result.runCount() == 1); assertTrue(result.failureCount() == 1); assertTrue(result.errorCount() == 0); }
Example 12
Source File: TestCaseTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
void verifySuccess(TestCase test) { TestResult result= test.run(); assertTrue(result.runCount() == 1); assertTrue(result.failureCount() == 0); assertTrue(result.errorCount() == 0); }
Example 13
Source File: MyUiAutomatorTestRunner.java From PUMA with Apache License 2.0 | 4 votes |
/** * Called after all test classes are in place, ready to test */ protected void start() { TestCaseCollector collector = getTestCaseCollector(this.getClass().getClassLoader()); try { collector.addTestClasses(mTestClasses); } catch (ClassNotFoundException e) { // will be caught by uncaught handler throw new RuntimeException(e.getMessage(), e); } if (mDebug) { Debug.waitForDebugger(); } mHandlerThread = new HandlerThread(HANDLER_THREAD_NAME); mHandlerThread.setDaemon(true); mHandlerThread.start(); UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper(); automationWrapper.connect(); long startTime = SystemClock.uptimeMillis(); TestResult testRunResult = new TestResult(); ResultReporter resultPrinter; String outputFormat = mParams.getString("outputFormat"); List<TestCase> testCases = collector.getTestCases(); Bundle testRunOutput = new Bundle(); if ("simple".equals(outputFormat)) { resultPrinter = new SimpleResultPrinter(System.out, true); } else { resultPrinter = new WatcherResultPrinter(testCases.size()); } try { automationWrapper.setRunAsMonkey(mMonkey); mUiDevice = MyUiDevice.getInstance(); UiAutomation uiAutomation = automationWrapper.getUiAutomation(); mUiDevice.initialize(new ShellUiAutomatorBridge(uiAutomation)); mUiDevice.setUiAutomation(uiAutomation); String traceType = mParams.getString("traceOutputMode"); if (traceType != null) { Tracer.Mode mode = Tracer.Mode.valueOf(Tracer.Mode.class, traceType); if (mode == Tracer.Mode.FILE || mode == Tracer.Mode.ALL) { String filename = mParams.getString("traceLogFilename"); if (filename == null) { throw new RuntimeException("Name of log file not specified. " + "Please specify it using traceLogFilename parameter"); } Tracer.getInstance().setOutputFilename(filename); } Tracer.getInstance().setOutputMode(mode); } // add test listeners testRunResult.addListener(resultPrinter); // add all custom listeners for (TestListener listener : mTestListeners) { testRunResult.addListener(listener); } // run tests for realz! for (TestCase testCase : testCases) { prepareTestCase(testCase); testCase.run(testRunResult); } } catch (Throwable t) { // catch all exceptions so a more verbose error message can be outputted resultPrinter.printUnexpectedError(t); } finally { long runTime = SystemClock.uptimeMillis() - startTime; resultPrinter.print(testRunResult, runTime, testRunOutput); automationWrapper.disconnect(); automationWrapper.setRunAsMonkey(false); mHandlerThread.quit(); } }