Search in sources :

Example 1 with TestFrameworkRunningModel

use of com.intellij.execution.testframework.TestFrameworkRunningModel in project intellij-community by JetBrains.

the class ImportedTestRunnableState method execute.

@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    final MyEmptyProcessHandler handler = new MyEmptyProcessHandler();
    final SMTRunnerConsoleProperties properties = myRunProfile.getProperties();
    RunProfile configuration;
    final String frameworkName;
    if (properties != null) {
        configuration = properties.getConfiguration();
        frameworkName = properties.getTestFrameworkName();
    } else {
        configuration = myRunProfile;
        frameworkName = "Import Test Results";
    }
    final ImportedTestConsoleProperties consoleProperties = new ImportedTestConsoleProperties(properties, myFile, handler, myRunProfile.getProject(), configuration, frameworkName, executor);
    final BaseTestsOutputConsoleView console = SMTestRunnerConnectionUtil.createConsole(consoleProperties.getTestFrameworkName(), consoleProperties);
    final JComponent component = console.getComponent();
    AbstractRerunFailedTestsAction rerunFailedTestsAction = null;
    if (component instanceof TestFrameworkRunningModel) {
        rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(console);
        if (rerunFailedTestsAction != null) {
            rerunFailedTestsAction.setModelProvider(() -> (TestFrameworkRunningModel) component);
        }
    }
    console.attachToProcess(handler);
    final DefaultExecutionResult result = new DefaultExecutionResult(console, handler);
    if (rerunFailedTestsAction != null) {
        result.setRestartActions(rerunFailedTestsAction);
    }
    return result;
}
Also used : TestFrameworkRunningModel(com.intellij.execution.testframework.TestFrameworkRunningModel) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) RunProfile(com.intellij.execution.configurations.RunProfile) BaseTestsOutputConsoleView(com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView) SMTRunnerConsoleProperties(com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with TestFrameworkRunningModel

use of com.intellij.execution.testframework.TestFrameworkRunningModel in project intellij-community by JetBrains.

the class AbstractRerunFailedTestsAction method isActive.

private boolean isActive(AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) {
        return false;
    }
    TestFrameworkRunningModel model = getModel();
    if (model == null || model.getRoot() == null) {
        return false;
    }
    Filter filter = getFailuresFilter();
    for (AbstractTestProxy test : model.getRoot().getAllTests()) {
        //noinspection unchecked
        if (filter.shouldAccept(test)) {
            return true;
        }
    }
    return false;
}
Also used : Project(com.intellij.openapi.project.Project) TestFrameworkRunningModel(com.intellij.execution.testframework.TestFrameworkRunningModel) Filter(com.intellij.execution.testframework.Filter) AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy)

Example 3 with TestFrameworkRunningModel

use of com.intellij.execution.testframework.TestFrameworkRunningModel in project intellij by bazelbuild.

the class BlazeRerunFailedTestsAction method getRunProfile.

@Override
@Nullable
protected MyRunProfile getRunProfile(ExecutionEnvironment environment) {
    final TestFrameworkRunningModel model = getModel();
    if (model == null) {
        return null;
    }
    BlazeCommandRunConfiguration config = (BlazeCommandRunConfiguration) model.getProperties().getConfiguration();
    return new BlazeRerunTestRunProfile(config.clone());
}
Also used : TestFrameworkRunningModel(com.intellij.execution.testframework.TestFrameworkRunningModel) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration) Nullable(javax.annotation.Nullable)

Aggregations

TestFrameworkRunningModel (com.intellij.execution.testframework.TestFrameworkRunningModel)3 BlazeCommandRunConfiguration (com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)1 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 RunProfile (com.intellij.execution.configurations.RunProfile)1 AbstractTestProxy (com.intellij.execution.testframework.AbstractTestProxy)1 Filter (com.intellij.execution.testframework.Filter)1 AbstractRerunFailedTestsAction (com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction)1 SMTRunnerConsoleProperties (com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties)1 BaseTestsOutputConsoleView (com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView)1 Project (com.intellij.openapi.project.Project)1 Nullable (javax.annotation.Nullable)1 Nullable (org.jetbrains.annotations.Nullable)1