159 }
160 }
161 return v.elements();
162 }
163
164
165 /**
166 * Invoke each of the selected test cases, based upon the select and exclude
167 * calls that have been made, if any.
168 * If the test object provides a public method
169 * {@link com.sun.javatest.Status}invokeTestCase({@link java.lang.reflect.Method})
170 * that method will be called to invoke the test cases; otherwise, the test
171 * cases will be invoked directly.
172 * It is an error if no test cases are selected, (or if they have all been excluded.)
173 * @return the combined result of executing all the test cases.
174 */
175 public Status invokeTestCases() {
176 // see if test object provides Status invokeTestCase(Method m)
177 Method invoker;
178 try {
179 invoker = testClass.getMethod("invokeTestCase", new Class<?>[] {Method.class});
180 if (!Status.class.isAssignableFrom(invoker.getReturnType()))
181 invoker = null;
182 }
183 catch (NoSuchMethodException e) {
184 invoker = null;
185 }
186
187 MultiStatus ms = new MultiStatus(log);
188 for (Enumeration<Method> e = enumerate(); e.hasMoreElements(); ) {
189 Method m = (e.nextElement());
190 Status s;
191 try {
192 if (invoker != null)
193 s = (Status)invoker.invoke(test, new Object[] {m});
194 else
195 s = (Status)m.invoke(test, noArgs);
196 }
197 catch (IllegalAccessException ex) {
198 s = Status.failed("Could not access test case: " + m.getName());
199 }
|
159 }
160 }
161 return v.elements();
162 }
163
164
165 /**
166 * Invoke each of the selected test cases, based upon the select and exclude
167 * calls that have been made, if any.
168 * If the test object provides a public method
169 * {@link com.sun.javatest.Status}invokeTestCase({@link java.lang.reflect.Method})
170 * that method will be called to invoke the test cases; otherwise, the test
171 * cases will be invoked directly.
172 * It is an error if no test cases are selected, (or if they have all been excluded.)
173 * @return the combined result of executing all the test cases.
174 */
175 public Status invokeTestCases() {
176 // see if test object provides Status invokeTestCase(Method m)
177 Method invoker;
178 try {
179 invoker = testClass.getMethod("invokeTestCase", Method.class);
180 if (!Status.class.isAssignableFrom(invoker.getReturnType()))
181 invoker = null;
182 }
183 catch (NoSuchMethodException e) {
184 invoker = null;
185 }
186
187 MultiStatus ms = new MultiStatus(log);
188 for (Enumeration<Method> e = enumerate(); e.hasMoreElements(); ) {
189 Method m = (e.nextElement());
190 Status s;
191 try {
192 if (invoker != null)
193 s = (Status)invoker.invoke(test, new Object[] {m});
194 else
195 s = (Status)m.invoke(test, noArgs);
196 }
197 catch (IllegalAccessException ex) {
198 s = Status.failed("Could not access test case: " + m.getName());
199 }
|