diff options
Diffstat (limited to 'plugins/testng/src/com/theoryinpractice/testng/ui')
4 files changed, 33 insertions, 12 deletions
diff --git a/plugins/testng/src/com/theoryinpractice/testng/ui/ResultTreeRenderer.java b/plugins/testng/src/com/theoryinpractice/testng/ui/ResultTreeRenderer.java index ba30f43b66f0..9ea4429447fe 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/ui/ResultTreeRenderer.java +++ b/plugins/testng/src/com/theoryinpractice/testng/ui/ResultTreeRenderer.java @@ -16,6 +16,7 @@ package com.theoryinpractice.testng.ui; import com.intellij.execution.testframework.PoolOfTestIcons; +import com.intellij.execution.testframework.TestFrameworkRunningModel; import com.intellij.icons.AllIcons; import com.intellij.ui.ColoredTreeCellRenderer; import com.intellij.ui.SimpleTextAttributes; @@ -34,10 +35,11 @@ import javax.swing.tree.DefaultMutableTreeNode; */ public class ResultTreeRenderer extends ColoredTreeCellRenderer { - private final TestNGConsoleProperties consoleProperties; - public ResultTreeRenderer(TestNGConsoleProperties consoleProperties) { - this.consoleProperties = consoleProperties; + private TestFrameworkRunningModel model; + + public ResultTreeRenderer(TestFrameworkRunningModel model) { + this.model = model; } @Override @@ -47,7 +49,7 @@ public class ResultTreeRenderer extends ColoredTreeCellRenderer TestProxy proxy = ((TestNodeDescriptor) node.getUserObject()).getElement(); if (node == tree.getModel().getRoot()) { TreeRootNode root = (TreeRootNode) proxy; - if (node.getChildCount() == 0) { + if (node.getChildCount() == 0 && !((TestNGResults)model).hasFinishedTests()) { if ((root.isStarted() && root.isInProgress()) || (root.isInProgress() && !root.isStarted())) { setIcon(PoolOfTestIcons.NOT_RAN); append("Instantiating tests... ", SimpleTextAttributes.REGULAR_ATTRIBUTES); @@ -64,13 +66,13 @@ public class ResultTreeRenderer extends ColoredTreeCellRenderer append(root.isInProgress() ? "Running tests..." : "Test Results", SimpleTextAttributes.REGULAR_ATTRIBUTES); } - if (consoleProperties.isPaused()) { + if (model.getProperties().isPaused()) { setIcon(AllIcons.RunConfigurations.TestPaused); } } else { if (proxy.getResultMessage() != null) { final TestResultMessage result = proxy.getResultMessage(); - final String name = TestProxy.toDisplayText(result, consoleProperties.getProject()); + final String name = TestProxy.toDisplayText(result, model.getProperties().getProject()); append(name, SimpleTextAttributes.REGULAR_ATTRIBUTES); } else { append(proxy.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES); diff --git a/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java b/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java index 442e03440ac5..78f980aea83d 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java +++ b/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java @@ -378,7 +378,7 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn rootNode.setStarted(true); } - public void finish() { + public void finish(final boolean started) { if (start > 0) { end = System.currentTimeMillis(); } @@ -409,6 +409,7 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn } } tree.repaint(); + TestsUIUtil.notifyByBalloon(project, started, rootNode, getProperties(), "in " + getTime()); } }); } @@ -466,6 +467,10 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn this.failedToStart = failedToStart; } + public boolean hasFinishedTests() { + return count > 0; + } + private class OpenSourceSelectionListener implements TreeSelectionListener { public void valueChanged(TreeSelectionEvent e) { diff --git a/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGTestTreeView.java b/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGTestTreeView.java index 48f252d828ee..7e5b7995af0c 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGTestTreeView.java +++ b/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGTestTreeView.java @@ -33,7 +33,7 @@ import javax.swing.tree.TreeSelectionModel; public class TestNGTestTreeView extends TestTreeView { protected TreeCellRenderer getRenderer(final TestConsoleProperties properties) { - return new ResultTreeRenderer((TestNGConsoleProperties)properties); + return new ResultTreeRenderer(getTestFrameworkRunningModel()); } public TestProxy getSelectedTest(@NotNull TreePath treepath) { diff --git a/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java b/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java index a3538059b1db..597bb5983876 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java +++ b/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java @@ -8,25 +8,26 @@ import com.intellij.execution.actions.JavaRerunFailedTestsAction; import com.intellij.execution.configurations.RunProfileState; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.execution.testframework.AbstractTestProxy; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.ComponentContainer; +import com.intellij.openapi.util.Computable; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiModifier; import com.intellij.psi.search.GlobalSearchScope; +import com.intellij.util.containers.ContainerUtil; import com.theoryinpractice.testng.configuration.SearchingForTestsTask; import com.theoryinpractice.testng.configuration.TestNGConfiguration; import com.theoryinpractice.testng.configuration.TestNGRunnableState; +import com.theoryinpractice.testng.util.TestNGUtil; import org.jetbrains.annotations.NotNull; import java.io.File; import java.net.ServerSocket; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; public class RerunFailedTestsAction extends JavaRerunFailedTestsAction { @@ -53,6 +54,19 @@ public class RerunFailedTestsAction extends JavaRerunFailedTestsAction { return new SearchingForTestsTask(serverSocket, config, tempFile, client) { @Override protected void fillTestObjects(final Map<PsiClass, Collection<PsiMethod>> classes) throws CantRunException { + final HashMap<PsiClass, Collection<PsiMethod>> fullClassList = ContainerUtil.newHashMap(); + super.fillTestObjects(fullClassList); + for (final PsiClass aClass : fullClassList.keySet()) { + if (!ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() { + @Override + public Boolean compute() { + return TestNGUtil.hasTest(aClass); + } + })) { + classes.put(aClass, fullClassList.get(aClass)); + } + } + final GlobalSearchScope scope = config.getConfigurationModule().getSearchScope(); final Project project = config.getProject(); for (AbstractTestProxy proxy : failedTests) { |