Search in sources :

Example 6 with AbstractTestProxy

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

the class AbstractTestTreeBuilder method repaintWithParents.

public void repaintWithParents(final AbstractTestProxy testProxy) {
    AbstractTestProxy current = testProxy;
    do {
        DefaultMutableTreeNode node = getNodeForElement(current);
        if (node != null) {
            JTree tree = getTree();
            ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
        }
        current = current.getParent();
    } while (current != null);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 7 with AbstractTestProxy

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

the class TrackCoverageAction method selectSubCoverage.

private void selectSubCoverage() {
    final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(myProperties.getProject());
    final CoverageSuitesBundle currentSuite = coverageDataManager.getCurrentSuitesBundle();
    if (currentSuite != null) {
        final AbstractTestProxy test = myModel.getTreeView().getSelectedTest();
        List<String> testMethods = new ArrayList<>();
        if (test != null && !test.isInProgress()) {
            final List<? extends AbstractTestProxy> list = test.getAllTests();
            for (AbstractTestProxy proxy : list) {
                final Location location = proxy.getLocation(myProperties.getProject(), myProperties.getScope());
                if (location != null) {
                    final PsiElement element = location.getPsiElement();
                    final String name = currentSuite.getCoverageEngine().getTestMethodName(element, proxy);
                    if (name != null) {
                        testMethods.add(name);
                    }
                }
            }
        }
        coverageDataManager.selectSubCoverage(currentSuite, testMethods);
    }
}
Also used : ArrayList(java.util.ArrayList) AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy) CoverageDataManager(com.intellij.coverage.CoverageDataManager) CoverageSuitesBundle(com.intellij.coverage.CoverageSuitesBundle) PsiElement(com.intellij.psi.PsiElement) Location(com.intellij.execution.Location)

Example 8 with AbstractTestProxy

use of com.intellij.execution.testframework.AbstractTestProxy in project android by JetBrains.

the class UnitTestTreeFixture method getAllTestsCount.

public int getAllTestsCount() {
    int count = 0;
    AbstractTestProxy root = getModel().getRoot();
    for (AbstractTestProxy test : root.getAllTests()) {
        if (test.isLeaf()) {
            count++;
        }
    }
    return count;
}
Also used : AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy)

Example 9 with AbstractTestProxy

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

the class AbstractExcludeFromRunAction method update.

@Override
public void update(AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    presentation.setVisible(false);
    final DataContext dataContext = e.getDataContext();
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    if (project != null) {
        final RunConfiguration configuration = RunConfiguration.DATA_KEY.getData(dataContext);
        if (isPatternBasedConfiguration(configuration)) {
            final AbstractTestProxy testProxy = AbstractTestProxy.DATA_KEY.getData(dataContext);
            if (testProxy != null) {
                final Location location = testProxy.getLocation(project, ((T) configuration).getConfigurationModule().getSearchScope());
                if (location != null) {
                    final PsiElement psiElement = location.getPsiElement();
                    if (psiElement instanceof PsiClass && getPattern((T) configuration).contains(((PsiClass) psiElement).getQualifiedName())) {
                        presentation.setVisible(true);
                    }
                }
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) PsiClass(com.intellij.psi.PsiClass) AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy) PsiElement(com.intellij.psi.PsiElement) Location(com.intellij.execution.Location)

Example 10 with AbstractTestProxy

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

the class AbstractExcludeFromRunAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    LOG.assertTrue(project != null);
    final T configuration = (T) RunConfiguration.DATA_KEY.getData(dataContext);
    LOG.assertTrue(configuration != null);
    final GlobalSearchScope searchScope = configuration.getConfigurationModule().getSearchScope();
    final AbstractTestProxy testProxy = AbstractTestProxy.DATA_KEY.getData(dataContext);
    LOG.assertTrue(testProxy != null);
    final String qualifiedName = ((PsiClass) testProxy.getLocation(project, searchScope).getPsiElement()).getQualifiedName();
    getPattern(configuration).remove(qualifiedName);
}
Also used : Project(com.intellij.openapi.project.Project) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) PsiClass(com.intellij.psi.PsiClass) AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy)

Aggregations

AbstractTestProxy (com.intellij.execution.testframework.AbstractTestProxy)21 Project (com.intellij.openapi.project.Project)6 PsiClass (com.intellij.psi.PsiClass)5 Nullable (org.jetbrains.annotations.Nullable)4 Executor (com.intellij.execution.Executor)3 Location (com.intellij.execution.Location)3 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)3 PsiElement (com.intellij.psi.PsiElement)3 NotNull (org.jetbrains.annotations.NotNull)3 DiffHyperlink (com.intellij.execution.testframework.stacktrace.DiffHyperlink)2 Module (com.intellij.openapi.module.Module)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 PsiMethod (com.intellij.psi.PsiMethod)2 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)2 ArrayList (java.util.ArrayList)2 IXMLElement (net.n3.nanoxml.IXMLElement)2 CodeInsightTestCase (com.intellij.codeInsight.CodeInsightTestCase)1 CoverageDataManager (com.intellij.coverage.CoverageDataManager)1 CoverageSuitesBundle (com.intellij.coverage.CoverageSuitesBundle)1 RunManager (com.intellij.execution.RunManager)1