hide ignored tests (IDEA-61369)

This commit is contained in:
anna
2012-07-13 17:52:28 +02:00
parent 557691e939
commit 1e00a12c68
8 changed files with 34 additions and 0 deletions
@@ -152,6 +152,11 @@ public class SMTestProxy extends AbstractTestProxy {
return myState.wasTerminated();
}
@Override
public boolean isIgnored() {
return myState.getMagnitude() == TestStateInfo.Magnitude.SKIPPED_INDEX;
}
public boolean isPassed() {
return myState.getMagnitude() == TestStateInfo.Magnitude.SKIPPED_INDEX ||
myState.getMagnitude() == TestStateInfo.Magnitude.COMPLETE_INDEX ||
@@ -47,6 +47,8 @@ public abstract class AbstractTestProxy extends CompositePrintable {
public abstract boolean isInterrupted();
public abstract boolean isIgnored();
public abstract boolean isPassed();
public abstract String getName();
@@ -72,6 +72,12 @@ public abstract class Filter<T extends AbstractTestProxy> {
}
};
public static final Filter IGNORED = new Filter() {
public boolean shouldAccept(final AbstractTestProxy test) {
return test.isIgnored();
}
};
public static final Filter NOT_PASSED = new Filter() {
public boolean shouldAccept(final AbstractTestProxy test) {
return !test.isPassed();
@@ -44,6 +44,7 @@ public abstract class TestConsoleProperties extends StoringPropertyContainer imp
public static final BooleanProperty SORT_ALPHABETICALLY = new BooleanProperty("sortTestsAlphabetically", false);
public static final BooleanProperty SELECT_FIRST_DEFECT = new BooleanProperty("selectFirtsDefect", false);
public static final BooleanProperty TRACK_RUNNING_TEST = new BooleanProperty("trackRunningTest", true);
public static final BooleanProperty HIDE_IGNORED_TEST = new BooleanProperty("hideIgnoredTests", false);
public static final BooleanProperty HIDE_PASSED_TESTS = new BooleanProperty("hidePassedTests", true);
public static final BooleanProperty SCROLL_TO_SOURCE = new BooleanProperty("scrollToSource", false);
public static final BooleanProperty OPEN_FAILURE_LINE = new BooleanProperty("openFailureLine", false);
@@ -67,6 +67,7 @@ public class ToolbarPanel extends JPanel implements OccurenceNavigator, Disposab
ExecutionBundle.message("junit.runing.info.track.test.action.description"),
AllIcons.RunConfigurations.TrackTests,
properties, TestConsoleProperties.TRACK_RUNNING_TEST)).setAsSecondary(true);
actionGroup.addAction(new ToggleBooleanProperty("Hide Ignored", null, null, properties, TestConsoleProperties.HIDE_IGNORED_TEST)).setAsSecondary(true);
actionGroup.addAction(new ToggleBooleanProperty(ExecutionBundle.message("junit.runing.info.sort.alphabetically.action.name"),
ExecutionBundle.message("junit.runing.info.sort.alphabetically.action.description"),
@@ -38,6 +38,15 @@ public class TestFrameworkActions {
}
};
addPropertyListener(TestConsoleProperties.HIDE_PASSED_TESTS, hidePropertyListener, model, true);
final TestConsoleProperties ignoreProperties = model.getProperties();
final TestFrameworkPropertyListener<Boolean> ignorePropertyListener = new TestFrameworkPropertyListener<Boolean>() {
public void onChanged(final Boolean value) {
final boolean shouldFilter = TestConsoleProperties.HIDE_IGNORED_TEST.value(ignoreProperties);
model.setFilter(shouldFilter ? Filter.IGNORED.not() : Filter.NO_FILTER);
}
};
addPropertyListener(TestConsoleProperties.HIDE_IGNORED_TEST, ignorePropertyListener, model, true);
}
public static void addPropertyListener(final AbstractProperty<Boolean> property,
@@ -141,6 +141,11 @@ public class TestProxy extends AbstractTestProxy {
return getMagnitude() == PoolOfTestStates.TERMINATED_INDEX;
}
@Override
public boolean isIgnored() {
return getMagnitude() == PoolOfTestStates.IGNORED_INDEX;
}
public boolean isPassed() {
return getMagnitude() <= PoolOfTestStates.PASSED_INDEX;
}
@@ -230,6 +230,11 @@ public class TestProxy extends AbstractTestProxy {
return !isInProgress() && inProgress;
}
@Override
public boolean isIgnored() {
return resultMessage != null && MessageHelper.SKIPPED_TEST == resultMessage.getResult();
}
public boolean isTearDownFailure() {
for (TestProxy result : results) {
if (result.isTearDownFailure()) return true;