Search in sources :

Example 1 with SMTRunnerConsoleView

use of com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView in project intellij-community by JetBrains.

the class PythonTestCommandLineStateBase method execute.

@Override
public ExecutionResult execute(Executor executor, PythonProcessStarter processStarter, CommandLinePatcher... patchers) throws ExecutionException {
    final ProcessHandler processHandler = startProcess(processStarter, patchers);
    final ConsoleView console = createAndAttachConsole(myConfiguration.getProject(), processHandler, executor);
    DefaultExecutionResult executionResult = new DefaultExecutionResult(console, processHandler, createActions(console, processHandler));
    PyRerunFailedTestsAction rerunFailedTestsAction = new PyRerunFailedTestsAction(console);
    if (console instanceof SMTRunnerConsoleView) {
        rerunFailedTestsAction.init(((BaseTestsOutputConsoleView) console).getProperties());
        rerunFailedTestsAction.setModelProvider(() -> ((SMTRunnerConsoleView) console).getResultsViewer());
    }
    executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
    return executionResult;
}
Also used : SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) BaseTestsOutputConsoleView(com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) PythonDebugLanguageConsoleView(com.jetbrains.python.console.PythonDebugLanguageConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction)

Example 2 with SMTRunnerConsoleView

use of com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView in project intellij-community by JetBrains.

the class JavaTestFrameworkRunnableState method execute.

@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    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);
    final AbstractTestProxy root = viewer.getRoot();
    if (root instanceof TestProxyRoot) {
        ((TestProxyRoot) root).setHandler(handler);
    }
    handler.addProcessListener(new ProcessAdapter() {

        @Override
        public void startNotified(ProcessEvent event) {
            if (getConfiguration().isSaveOutputToFile()) {
                final File file = OutputFileUtil.getOutputFile(getConfiguration());
                root.setOutputFilePath(file != null ? file.getAbsolutePath() : null);
            }
        }

        @Override
        public void processTerminated(ProcessEvent event) {
            Runnable runnable = () -> {
                root.flushOutputFile();
                deleteTempFiles();
                clear();
            };
            UIUtil.invokeLaterIfNeeded(runnable);
            handler.removeProcessListener(this);
        }
    });
    AbstractRerunFailedTestsAction rerunFailedTestsAction = testConsoleProperties.createRerunFailedTestsAction(consoleView);
    LOG.assertTrue(rerunFailedTestsAction != null);
    rerunFailedTestsAction.setModelProvider(() -> viewer);
    final DefaultExecutionResult result = new DefaultExecutionResult(consoleView, handler);
    result.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction() {

        @Override
        public boolean isDelayApplicable() {
            return false;
        }

        @Override
        public AbstractAutoTestManager getAutoTestManager(Project project) {
            return JavaAutoRunManager.getInstance(project);
        }
    });
    JavaRunConfigurationExtensionManager.getInstance().attachExtensionsToProcess(getConfiguration(), handler, runnerSettings);
    return result;
}
Also used : SMTestRunnerResultsForm(com.intellij.execution.testframework.sm.runner.ui.SMTestRunnerResultsForm) ProcessAdapter(com.intellij.execution.process.ProcessAdapter) AbstractAutoTestManager(com.intellij.execution.testframework.autotest.AbstractAutoTestManager) GenericDebuggerRunnerSettings(com.intellij.debugger.impl.GenericDebuggerRunnerSettings) ProcessEvent(com.intellij.execution.process.ProcessEvent) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction) BaseTestsOutputConsoleView(com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView) SMTRunnerConsoleProperties(com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) Project(com.intellij.openapi.project.Project) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with SMTRunnerConsoleView

use of com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView in project intellij-plugins by JetBrains.

the class DartTestRunningState method execute.

@Override
@NotNull
public ExecutionResult execute(@NotNull final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException {
    final ProcessHandler processHandler = startProcess();
    final ConsoleView consoleView = createConsole(getEnvironment());
    consoleView.attachToProcess(processHandler);
    final DefaultExecutionResult executionResult = new DefaultExecutionResult(consoleView, processHandler, createActions(consoleView, processHandler, executor));
    if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
        DartConsoleProperties properties = (DartConsoleProperties) ((SMTRunnerConsoleView) consoleView).getProperties();
        AbstractRerunFailedTestsAction rerunFailedTestsAction = properties.createRerunFailedTestsAction(consoleView);
        assert rerunFailedTestsAction != null;
        rerunFailedTestsAction.setModelProvider(((SMTRunnerConsoleView) consoleView)::getResultsViewer);
        executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
    } else {
        executionResult.setRestartActions(new ToggleAutoTestAction());
    }
    return executionResult;
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with SMTRunnerConsoleView

use of com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoTestRunningState method execute.

@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    ProcessHandler processHandler = startProcess();
    TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(myConfiguration.getProject());
    setConsoleBuilder(consoleBuilder);
    GoTestConsoleProperties consoleProperties = new GoTestConsoleProperties(myConfiguration, executor);
    String frameworkName = myConfiguration.getTestFramework().getName();
    ConsoleView consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole(frameworkName, processHandler, consoleProperties);
    consoleView.addMessageFilter(new GoConsoleFilter(myConfiguration.getProject(), myModule, myConfiguration.getWorkingDirectoryUrl()));
    ProcessTerminatedListener.attach(processHandler);
    DefaultExecutionResult executionResult = new DefaultExecutionResult(consoleView, processHandler);
    AbstractRerunFailedTestsAction rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(consoleView);
    if (rerunFailedTestsAction != null) {
        rerunFailedTestsAction.setModelProvider(((SMTRunnerConsoleView) consoleView)::getResultsViewer);
        executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
    } else {
        executionResult.setRestartActions(new ToggleAutoTestAction());
    }
    return executionResult;
}
Also used : GoConsoleFilter(com.goide.runconfig.GoConsoleFilter) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with SMTRunnerConsoleView

use of com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView in project intellij-community by JetBrains.

the class SMTestRunnerConnectionUtil method createConsole.

@NotNull
public static BaseTestsOutputConsoleView createConsole(@NotNull String testFrameworkName, @NotNull TestConsoleProperties consoleProperties) {
    String splitterPropertyName = getSplitterPropertyName(testFrameworkName);
    SMTRunnerConsoleView consoleView = new SMTRunnerConsoleView(consoleProperties, splitterPropertyName);
    initConsoleView(consoleView, testFrameworkName);
    return consoleView;
}
Also used : SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SMTRunnerConsoleView (com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView)8 NotNull (org.jetbrains.annotations.NotNull)6 ToggleAutoTestAction (com.intellij.execution.testframework.autotest.ToggleAutoTestAction)5 ProcessHandler (com.intellij.execution.process.ProcessHandler)4 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)3 AbstractRerunFailedTestsAction (com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction)3 ConsoleView (com.intellij.execution.ui.ConsoleView)3 ProcessEvent (com.intellij.execution.process.ProcessEvent)2 BaseTestsOutputConsoleView (com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView)2 GoConsoleFilter (com.goide.runconfig.GoConsoleFilter)1 CodeInsightTestCase (com.intellij.codeInsight.CodeInsightTestCase)1 GenericDebuggerRunnerSettings (com.intellij.debugger.impl.GenericDebuggerRunnerSettings)1 Executor (com.intellij.execution.Executor)1 RunManager (com.intellij.execution.RunManager)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)1 HyperlinkInfo (com.intellij.execution.filters.HyperlinkInfo)1 TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)1 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)1