@Override protected IStatus run(IProgressMonitor monitor) { try { JstdLaunchConfiguration launchConfiguration = new JstdLaunchConfiguration(configuration); for (ILaunchValidator validator : validators) { if (!validator.preLaunchCheck(launchConfiguration, monitor)) { // we do not want to report this as an error to job scheduler return Status.OK_STATUS; } } // initialize JsTestDriverView; this needs to be done in UI thread Display.getDefault() .asyncExec(new BeforeTestsViewInitialization(getTestsNumber(), configuration, logger)); if (testsToRun.isEmpty()) { runner.runAllTests(launchConfiguration); } else { runner.runTests(testsToRun, launchConfiguration); } } catch (CoreException e) { logger.log(Level.SEVERE, "", e); return new Status(Status.ERROR, Activator.PLUGIN_ID, ERROR_MESSAGE, e); } catch (BrowserPanicException e) { logger.log(Level.SEVERE, "", e); return new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); } return Status.OK_STATUS; }
private int getTestsNumber() throws CoreException { if (testsToRun.isEmpty()) { Collection<TestCase> testCases = runner.getTestCases(configuration); return calcTestsNumber(testCases); } return testsToRun.size(); }