Search in sources :

Example 41 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij by bazelbuild.

the class SmRunnerUtils method getSelectedSmRunnerTreeElements.

public static List<Location<?>> getSelectedSmRunnerTreeElements(ConfigurationContext context) {
    Project project = context.getProject();
    List<SMTestProxy> tests = getSelectedTestProxies(context);
    return tests.stream().map(test -> (Location<?>) test.getLocation(project, GlobalSearchScope.allScope(project))).filter(Objects::nonNull).collect(Collectors.toList());
}
Also used : Project(com.intellij.openapi.project.Project) SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 42 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij by bazelbuild.

the class SmRunnerUtils method countSelectedTestCases.

/**
 * Counts all selected test cases, and their children, recursively
 */
public static int countSelectedTestCases(ConfigurationContext context) {
    List<SMTestProxy> tests = getSelectedTestProxies(context);
    Set<SMTestProxy> allTests = new HashSet<>(tests);
    for (SMTestProxy test : tests) {
        allTests.addAll(test.collectChildren());
    }
    return allTests.size();
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) HashSet(java.util.HashSet)

Aggregations

SMTestProxy (com.intellij.execution.testframework.sm.runner.SMTestProxy)42 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)9 Project (com.intellij.openapi.project.Project)8 Location (com.intellij.execution.Location)6 PsiClass (com.intellij.psi.PsiClass)6 MethodLocation (com.intellij.execution.junit2.info.MethodLocation)5 PsiMemberParameterizedLocation (com.intellij.execution.junit2.PsiMemberParameterizedLocation)4 PsiElement (com.intellij.psi.PsiElement)4 PsiMethod (com.intellij.psi.PsiMethod)4 JavaTestLocator (com.intellij.execution.testframework.JavaTestLocator)3 List (java.util.List)3 AbstractTestProxy (com.intellij.execution.testframework.AbstractTestProxy)2 SMTRunnerTreeStructure (com.intellij.execution.testframework.sm.runner.SMTRunnerTreeStructure)2 Ref (com.intellij.openapi.util.Ref)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 NotNull (org.jetbrains.annotations.NotNull)2 ExecutionException (com.intellij.execution.ExecutionException)1 JavaTestConfigurationBase (com.intellij.execution.JavaTestConfigurationBase)1