fixed PY-4245 Way to rerun failed tests

This commit is contained in:
Ekaterina Tuzova
2012-10-02 14:40:39 +04:00
parent 910f67e294
commit a4045f4958
5 changed files with 60 additions and 10 deletions
@@ -0,0 +1,42 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* User: anna
* Date: 24-Dec-2008
*/
package com.intellij.execution.actions;
import com.intellij.execution.testframework.Filter;
import com.intellij.execution.testframework.JavaAwareFilter;
import com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentContainer;
import org.jetbrains.annotations.NotNull;
public class JavaRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
protected JavaRerunFailedTestsAction(@NotNull ComponentContainer componentContainer) {
super(componentContainer);
}
@NotNull
@Override
protected Filter getFilter(Project project) {
return Filter.FAILED_OR_INTERRUPTED.and(JavaAwareFilter.METHOD(project));
}
}
@@ -18,7 +18,7 @@
* User: anna
* Date: 24-Dec-2008
*/
package com.intellij.execution.actions;
package com.intellij.execution.testframework.actions;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
@@ -130,18 +130,23 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction
if (model == null || model.getRoot() == null) return false;
final List<? extends AbstractTestProxy> myAllTests = model.getRoot().getAllTests();
for (Object test : myAllTests) {
if (Filter.FAILED_OR_INTERRUPTED.and(JavaAwareFilter.METHOD(project)).shouldAccept((AbstractTestProxy)test)) return true;
if (getFilter(project).shouldAccept((AbstractTestProxy)test)) return true;
}
return false;
}
@NotNull
protected List<AbstractTestProxy> getFailedTests(Project project) {
protected List<AbstractTestProxy> getFailedTests(Project project){
TestFrameworkRunningModel model = getModel();
final List<? extends AbstractTestProxy> myAllTests = model != null
? model.getRoot().getAllTests()
: Collections.<AbstractTestProxy>emptyList();
return Filter.FAILED_OR_INTERRUPTED.and(JavaAwareFilter.METHOD(project)).select(myAllTests);
return getFilter(project).select(myAllTests);
}
@NotNull
protected Filter getFilter(Project project) {
return Filter.FAILED_OR_INTERRUPTED;
}
public void actionPerformed(AnActionEvent e) {
@@ -190,6 +195,10 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction
}
protected static abstract class MyRunProfile extends RunConfigurationBase implements ModuleRunProfile{
public RunConfigurationBase getConfiguration() {
return myConfiguration;
}
private final RunConfigurationBase myConfiguration;
public MyRunProfile(RunConfigurationBase configuration) {
@@ -18,7 +18,7 @@ package com.intellij.execution.junit2.ui.actions;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
import com.intellij.execution.actions.AbstractRerunFailedTestsAction;
import com.intellij.execution.actions.JavaRerunFailedTestsAction;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.junit.JUnitConfiguration;
import com.intellij.execution.junit.TestMethods;
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
/**
* @author Alexey
*/
public class RerunFailedTestsAction extends AbstractRerunFailedTestsAction {
public class RerunFailedTestsAction extends JavaRerunFailedTestsAction {
public RerunFailedTestsAction(@NotNull ComponentContainer componentContainer) {
super(componentContainer);
@@ -1,11 +1,10 @@
package com.theoryinpractice.testng.ui.actions;
import com.intellij.execution.CantRunException;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
import com.intellij.execution.Location;
import com.intellij.execution.actions.AbstractRerunFailedTestsAction;
import com.intellij.execution.actions.JavaRerunFailedTestsAction;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.testframework.AbstractTestProxy;
@@ -26,7 +25,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
public class RerunFailedTestsAction extends AbstractRerunFailedTestsAction {
public class RerunFailedTestsAction extends JavaRerunFailedTestsAction {
public RerunFailedTestsAction(@NotNull ComponentContainer componentContainer) {
super(componentContainer);
+1 -1
View File
@@ -28,7 +28,7 @@
<xi:include href="/idea/LangActions.xml" xpointer="xpointer(/component/*)"/>
<actions>
<action id="RerunFailedTests" class="com.intellij.execution.actions.AbstractRerunFailedTestsAction"
<action id="RerunFailedTests" class="com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction"
icon="AllIcons.RunConfigurations.RerunFailedTests"/>
<action id="FileChooser.GotoModule" class="com.intellij.openapi.fileChooser.actions.GotoModuleDirectory"