com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView Java Examples

The following examples show how to use com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView. 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: SmRunnerUtils.java    From intellij with Apache License 2.0 6 votes vote down vote up
public static SMTRunnerConsoleView getConsoleView(
    Project project,
    BlazeCommandRunConfiguration configuration,
    Executor executor,
    BlazeTestUiSession testUiSession) {
  SMTRunnerConsoleProperties properties =
      new BlazeTestConsoleProperties(configuration, executor, testUiSession);
  SMTRunnerConsoleView console =
      (SMTRunnerConsoleView)
          SMTestRunnerConnectionUtil.createConsole(BLAZE_FRAMEWORK, properties);
  Disposer.register(project, console);
  console
      .getResultsViewer()
      .getTreeView()
      .getSelectionModel()
      .setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
  return console;
}
 
Example #2
Source File: SmRunnerUtils.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Nullable
public static AbstractRerunFailedTestsAction createRerunFailedTestsAction(
    DefaultExecutionResult result) {
  ExecutionConsole console = result.getExecutionConsole();
  if (!(console instanceof SMTRunnerConsoleView)) {
    return null;
  }
  SMTRunnerConsoleView smConsole = (SMTRunnerConsoleView) console;
  TestConsoleProperties consoleProperties = smConsole.getProperties();
  if (!(consoleProperties instanceof BlazeTestConsoleProperties)) {
    return null;
  }
  BlazeTestConsoleProperties properties = (BlazeTestConsoleProperties) consoleProperties;
  AbstractRerunFailedTestsAction action = properties.createRerunFailedTestsAction(smConsole);
  if (action != null) {
    action.init(properties);
    action.setModelProvider(smConsole::getResultsViewer);
  }
  return action;
}
 
Example #3
Source File: GaugeCommandLineState.java    From Intellij-Plugin with Apache License 2.0 6 votes vote down vote up
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    addProjectClasspath();
    if (GaugeVersion.isGreaterOrEqual(GaugeRunConfiguration.TEST_RUNNER_SUPPORT_VERSION, false)
            && GaugeSettingsService.getSettings().useIntelliJTestRunner()) {
        ProcessHandler handler = startProcess();
        GaugeConsoleProperties properties = new GaugeConsoleProperties(config, "Gauge", executor, handler);
        ConsoleView console = SMTestRunnerConnectionUtil.createAndAttachConsole("Gauge", handler, properties);
        DefaultExecutionResult result = new DefaultExecutionResult(console, handler, createActions(console, handler));
        if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
            AbstractRerunFailedTestsAction action = properties.createRerunFailedTestsAction(console);
            if (action != null) {
                action.setModelProvider(((SMTRunnerConsoleView) console)::getResultsViewer);
                result.setRestartActions(action);
            }
        }
        return result;
    }
    return super.execute(executor, runner);
}
 
Example #4
Source File: ThriftTestExecutionUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void initConsoleView(@Nonnull final SMTRunnerConsoleView consoleView,
                                   @Nonnull final String testFrameworkName,
                                   @javax.annotation.Nullable final TestLocationProvider locator,
                                   final ThriftTestHandlerFactory factory,
                                   @Nullable final TestProxyFilterProvider filterProvider) {
  consoleView.addAttachToProcessListener(new AttachToProcessListener() {
    @Override
    public void onAttachToProcess(@Nonnull ProcessHandler processHandler) {
      TestProxyPrinterProvider printerProvider = null;
      if (filterProvider != null) {
        printerProvider = new TestProxyPrinterProvider(consoleView, filterProvider);
      }
      SMTestRunnerResultsForm resultsForm = consoleView.getResultsViewer();
      attachEventsProcessors(consoleView.getProperties(), resultsForm, resultsForm.getStatisticsPane(), processHandler, testFrameworkName, locator, factory,
                             printerProvider);
    }
  });
  consoleView.setHelpId("reference.runToolWindow.testResultsTab");
  consoleView.initUI();
}
 
Example #5
Source File: SMTestRunnerConnectionUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * @deprecated use {@link #initConsoleView(SMTRunnerConsoleView, String)} (to be removed in IDEA 16)
 */
@SuppressWarnings({"unused", "deprecation"})
public static void initConsoleView(@Nonnull final SMTRunnerConsoleView consoleView,
                                   @Nonnull final String testFrameworkName,
                                   @javax.annotation.Nullable final TestLocationProvider locator,
                                   final boolean idBasedTreeConstruction,
                                   @Nullable final TestProxyFilterProvider filterProvider) {
  consoleView.addAttachToProcessListener(new AttachToProcessListener() {
    @Override
    public void onAttachToProcess(@Nonnull ProcessHandler processHandler) {
      TestConsoleProperties properties = consoleView.getProperties();

      SMTestLocator testLocator = new CompositeTestLocationProvider(locator);

      TestProxyPrinterProvider printerProvider = null;
      if (filterProvider != null) {
        printerProvider = new TestProxyPrinterProvider(consoleView, filterProvider);
      }

      SMTestRunnerResultsForm resultsForm = consoleView.getResultsViewer();
      attachEventsProcessors(properties, resultsForm, resultsForm.getStatisticsPane(), processHandler, testFrameworkName, testLocator, idBasedTreeConstruction, printerProvider);
    }
  });
  consoleView.setHelpId("reference.runToolWindow.testResultsTab");
  consoleView.initUI();
}
 
Example #6
Source File: ThriftTestExecutionUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static SMTRunnerConsoleView createConsoleWithCustomLocator(@Nonnull final String testFrameworkName,
                                                                  @Nonnull final TestConsoleProperties consoleProperties,
                                                                  ExecutionEnvironment environment,
                                                                  @javax.annotation.Nullable final TestLocationProvider locator,
                                                                  final ThriftTestHandlerFactory factory,
                                                                  @Nullable final TestProxyFilterProvider filterProvider) {
  String splitterPropertyName = SMTestRunnerConnectionUtil.getSplitterPropertyName(testFrameworkName);
  SMTRunnerConsoleView consoleView = new SMTRunnerConsoleView(consoleProperties, splitterPropertyName);
  initConsoleView(consoleView, testFrameworkName, locator, factory, filterProvider);
  return consoleView;
}
 
Example #7
Source File: SMTestRunnerConnectionUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static BaseTestsOutputConsoleView createConsole(@Nonnull String testFrameworkName, @Nonnull TestConsoleProperties consoleProperties) {
  String splitterPropertyName = getSplitterPropertyName(testFrameworkName);
  SMTRunnerConsoleView consoleView = new SMTRunnerConsoleView(consoleProperties, splitterPropertyName);
  initConsoleView(consoleView, testFrameworkName);
  return consoleView;
}
 
Example #8
Source File: SMTestRunnerConnectionUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void initConsoleView(@Nonnull final SMTRunnerConsoleView consoleView, @Nonnull final String testFrameworkName) {
  consoleView.addAttachToProcessListener(new AttachToProcessListener() {
    @Override
    public void onAttachToProcess(@Nonnull ProcessHandler processHandler) {
      TestConsoleProperties properties = consoleView.getProperties();

      TestProxyPrinterProvider printerProvider = null;
      if (properties instanceof SMTRunnerConsoleProperties) {
        TestProxyFilterProvider filterProvider = ((SMTRunnerConsoleProperties)properties).getFilterProvider();
        if (filterProvider != null) {
          printerProvider = new TestProxyPrinterProvider(consoleView, filterProvider);
        }
      }

      SMTestLocator testLocator = FileUrlProvider.INSTANCE;
      if (properties instanceof SMTRunnerConsoleProperties) {
        SMTestLocator customLocator = ((SMTRunnerConsoleProperties)properties).getTestLocator();
        if (customLocator != null) {
          testLocator = new CombinedTestLocator(customLocator);
        }
      }

      boolean idBasedTestTree = false;
      if (properties instanceof SMTRunnerConsoleProperties) {
        idBasedTestTree = ((SMTRunnerConsoleProperties)properties).isIdBasedTestTree();
      }

      SMTestRunnerResultsForm resultsForm = consoleView.getResultsViewer();
      attachEventsProcessors(properties, resultsForm, resultsForm.getStatisticsPane(), processHandler, testFrameworkName, testLocator, idBasedTestTree, printerProvider);
    }
  });
  consoleView.setHelpId("reference.runToolWindow.testResultsTab");
  consoleView.initUI();
}
 
Example #9
Source File: SMTestRunnerConnectionUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated use {@link #createConsole(String, TestConsoleProperties)} (to be removed in IDEA 16)
 */
@SuppressWarnings({"unused", "deprecation"})
public static SMTRunnerConsoleView createConsoleWithCustomLocator(@Nonnull String testFrameworkName,
                                                                  @Nonnull TestConsoleProperties consoleProperties,
                                                                  ExecutionEnvironment environment,
                                                                  @Nullable TestLocationProvider locator,
                                                                  boolean idBasedTreeConstruction,
                                                                  @javax.annotation.Nullable TestProxyFilterProvider filterProvider) {
  String splitterPropertyName = getSplitterPropertyName(testFrameworkName);
  SMTRunnerConsoleView consoleView = new SMTRunnerConsoleView(consoleProperties, splitterPropertyName);
  initConsoleView(consoleView, testFrameworkName, locator, idBasedTreeConstruction, filterProvider);
  return consoleView;
}
 
Example #10
Source File: Unity3dTestRunState.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
@RequiredUIAccess
public ExecutionResult execute(Executor executor, @Nonnull ProgramRunner runner) throws ExecutionException
{
	Unity3dTestConfiguration profile = (Unity3dTestConfiguration) myEnvironment.getRunProfile();

	TestConsoleProperties testConsoleProperties = new SMTRunnerConsoleProperties(profile, TEST_FRAMEWORK_NAME, executor);

	testConsoleProperties.setIfUndefined(TestConsoleProperties.HIDE_PASSED_TESTS, false);

	String splitterPropertyName = SMTestRunnerConnectionUtil.getSplitterPropertyName(TEST_FRAMEWORK_NAME);

	final SMTRunnerConsoleView consoleView = new SMTRunnerConsoleView(testConsoleProperties, splitterPropertyName);

	final SimpleReference<UUID> ref = SimpleReference.create();

	consoleView.addAttachToProcessListener(new AttachToProcessListener()
	{
		@Override
		public void onAttachToProcess(@Nonnull ProcessHandler processHandler)
		{
			SMTestRunnerResultsForm resultsForm = consoleView.getResultsViewer();

			ref.set(attachEventsProcessors(consoleView.getProperties(), resultsForm, resultsForm.getStatisticsPane(), processHandler, TEST_FRAMEWORK_NAME));
		}
	});
	consoleView.setHelpId("reference.runToolWindow.testResultsTab");
	consoleView.initUI();

	final ProcessHandler osProcessHandler = new DefaultDebugProcessHandler();

	consoleView.attachToProcess(osProcessHandler);

	UnityRunTest runTest = new UnityRunTest();
	runTest.uuid = ref.get().toString();
	runTest.type = "";

	if(!UnityEditorCommunication.request(profile.getProject(), runTest, true))
	{
		ApplicationManager.getApplication().executeOnPooledThread(new Runnable()
		{
			@Override
			public void run()
			{
				osProcessHandler.notifyTextAvailable("UnityEditor dont received request, maybe is not run", ProcessOutputTypes.STDERR);
				osProcessHandler.destroyProcess();
			}
		});
	}

	return new DefaultExecutionResult(consoleView, osProcessHandler);
}