/** * Run the test in an environment where * we can handle the exceptions generated by the test method.*/ public void run() { try { runTestCase(); } catch(Throwable t) /* Any other exception we handle and then we interrupt the other threads.*/ { handleException(t); interruptThreads(); } } }
/** * Create instances of classes and run threads with it. * @param clazz - class of test thread implementation. * @param numThreads - number of threads to run. * @throws InstantiationException * @throws IllegalAccessException */ protected void runTestCaseThreads(Class<?> clazz, int numThreads) { TestCaseRunnable[] runnables = new TestCaseRunnable[numThreads]; for (int i = 0; i < runnables.length; i++) { try { runnables[i]= (TestCaseRunnable) clazz.newInstance(); } catch (Exception e) { testResult.addError(this, e); return; } } runTestCaseRunnables(runnables); } /**
/** * Create instances of classes and run threads with it. * @param clazz - class of test thread implementation. * @param numThreads - number of threads to run. * @throws InstantiationException * @throws IllegalAccessException */ protected void runTestCaseThreads(Class<?> clazz, int numThreads) { TestCaseRunnable[] runnables = new TestCaseRunnable[numThreads]; for (int i = 0; i < runnables.length; i++) { try { runnables[i]= (TestCaseRunnable) clazz.newInstance(); } catch (Exception e) { testResult.addError(this, e); return; } } runTestCaseRunnables(runnables); } /**
/** * Run the test in an environment where * we can handle the exceptions generated by the test method.*/ public void run() { try { runTestCase(); } catch(Throwable t) /* Any other exception we handle and then we interrupt the other threads.*/ { handleException(t); interruptThreads(); } } }