From 7bb6184a197ded7094c362732233950bdc5805fa Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Mon, 8 Jan 2018 17:30:07 +0100 Subject: [PATCH] all tests passed except ignored message on root node without children (IDEA-184623) --- .../src/messages/SMTestsRunnerBundle.properties | 1 + .../sm/runner/ui/TestsPresentationUtil.java | 6 ++++++ .../sm/runner/ui/TestsPresentationUtilTest.java | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties b/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties index d5c4bd3b0a28..55c648c61a80 100644 --- a/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties +++ b/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties @@ -17,6 +17,7 @@ sm.test.runner.ui.tests.tree.presentation.labels.test.reporter.not.attached=Test sm.test.runner.ui.tests.tree.presentation.labels.no.tests.were.found.with.errors=No tests were found. Errors occurred sm.test.runner.ui.tests.tree.presentation.labels.empty.test.suite=Empty test suite sm.test.runner.ui.tests.tree.presentation.labels.all.tests.passed=All Tests Passed +sm.test.runner.ui.tests.tree.presentation.labels.all.but.ignored.passed=All Tests Passed (except ignored) sm.test.runner.ui.tests.tree.presentation.labels.test.noname= sm.test.runner.ui.tabs.statistics.columns.test.title=Test diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtil.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtil.java index cfdd9eb37b4f..468629252c5e 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtil.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtil.java @@ -167,6 +167,12 @@ public class TestsPresentationUtil { "sm.test.runner.ui.tests.tree.presentation.labels.all.tests.passed"), SimpleTextAttributes.REGULAR_ATTRIBUTES); } + else if (magnitude == TestStateInfo.Magnitude.IGNORED_INDEX && !testProxy.hasErrors()) { + renderer.setIcon(PoolOfTestIcons.IGNORED_ICON); + renderer.append(SMTestsRunnerBundle.message( + "sm.test.runner.ui.tests.tree.presentation.labels.all.but.ignored.passed"), + SimpleTextAttributes.REGULAR_ATTRIBUTES ); + } else { if (!testProxy.getChildren().isEmpty()) { // some times test proxy may be updated faster than tests tree diff --git a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtilTest.java b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtilTest.java index 1a7dca89aa4b..dfbaa3b4fc4e 100644 --- a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtilTest.java +++ b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtilTest.java @@ -611,6 +611,23 @@ public class TestsPresentationUtilTest extends BaseSMTRunnerTestCase { assertEquals(SimpleTextAttributes.REGULAR_ATTRIBUTES, myFragContainer.getAttribsAt(0)); } + public void testFormatRootNodeIgnored() { + mySMRootTestProxy.setTestsReporterAttached(); + // See [PY-2434] Unittest: Do not show "No test were found" notification before completing test suite + mySMRootTestProxy.addChild(mySimpleTest); + mySMRootTestProxy.setStarted(); + mySimpleTest.setStarted(); + mySimpleTest.setTestIgnored(null, null); + mySimpleTest.setFinished(); + mySMRootTestProxy.setFinished(); + TestsPresentationUtil.formatRootNodeWithoutChildren(mySMRootTestProxy, myRenderer); + + assertEquals(PoolOfTestIcons.IGNORED_ICON, myRenderer.getIcon()); + assertOneElement(myFragContainer.getFragments()); + assertEquals("All Tests Passed (except ignored)", myFragContainer.getTextAt(0)); + assertEquals(SimpleTextAttributes.REGULAR_ATTRIBUTES, myFragContainer.getAttribsAt(0)); + } + public void testGetPresentableName() { //Test unit examples