Пример #1
0
 @Override
 public void initUI() {
   super.initUI();
   final TestTreeView testTreeView = testNGResults.getTreeView();
   testTreeView
       .getSelectionModel()
       .addTreeSelectionListener(
           new TreeSelectionListener() {
             public void valueChanged(TreeSelectionEvent e) {
               getPrinter().updateOnTestSelected(testTreeView.getSelectedTest());
             }
           });
 }
  protected ExecutionResult startSMRunner(Executor executor) throws ExecutionException {
    if (!isSmRunnerUsed()) {
      return null;
    }
    getJavaParameters()
        .getVMParametersList()
        .addProperty("idea." + getFrameworkId() + ".sm_runner");

    final RunnerSettings runnerSettings = getRunnerSettings();

    final SMTRunnerConsoleProperties testConsoleProperties =
        getConfiguration().createTestConsoleProperties(executor);
    testConsoleProperties.setIfUndefined(TestConsoleProperties.HIDE_PASSED_TESTS, false);

    final BaseTestsOutputConsoleView consoleView =
        SMTestRunnerConnectionUtil.createConsole(getFrameworkName(), testConsoleProperties);
    final SMTestRunnerResultsForm viewer = ((SMTRunnerConsoleView) consoleView).getResultsViewer();
    Disposer.register(getConfiguration().getProject(), consoleView);

    final OSProcessHandler handler = createHandler(executor);
    consoleView.attachToProcess(handler);
    handler.addProcessListener(
        new ProcessAdapter() {
          @Override
          public void startNotified(ProcessEvent event) {
            if (getConfiguration().isSaveOutputToFile()) {
              viewer.getRoot().setOutputFilePath(getConfiguration().getOutputFilePath());
            }
          }

          @Override
          public void processTerminated(ProcessEvent event) {
            Runnable runnable =
                new Runnable() {
                  public void run() {
                    viewer.getRoot().flush();
                    deleteTempFiles();
                    clear();
                  }
                };
            UIUtil.invokeLaterIfNeeded(runnable);
            handler.removeProcessListener(this);
          }
        });

    AbstractRerunFailedTestsAction rerunFailedTestsAction =
        testConsoleProperties.createRerunFailedTestsAction(consoleView);
    LOG.assertTrue(rerunFailedTestsAction != null);
    rerunFailedTestsAction.setModelProvider(
        new Getter<TestFrameworkRunningModel>() {
          @Override
          public TestFrameworkRunningModel get() {
            return viewer;
          }
        });

    final DefaultExecutionResult result = new DefaultExecutionResult(consoleView, handler);
    result.setRestartActions(rerunFailedTestsAction);

    JavaRunConfigurationExtensionManager.getInstance()
        .attachExtensionsToProcess(getConfiguration(), handler, runnerSettings);
    return result;
  }
Пример #3
0
 @Override
 public void dispose() {
   super.dispose();
   testNGResults = null;
 }