diff --git a/plugins/junit/src/com/intellij/execution/junit/TestMethods.java b/plugins/junit/src/com/intellij/execution/junit/TestMethods.java index ad3db575e52e..3ed43eccce78 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestMethods.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestMethods.java @@ -35,7 +35,6 @@ import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiMethod; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.util.Function; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -58,10 +57,11 @@ public class TestMethods extends TestMethod { protected JavaParameters createJavaParameters() throws ExecutionException { final JavaParameters javaParameters = super.createDefaultJavaParameters(); final JUnitConfiguration.Data data = getConfiguration().getPersistentData(); - RunConfigurationModule module = getConfiguration().getConfigurationModule(); - final Project project = module.getProject(); - final SourceScope scope = getSourceScope(); - final GlobalSearchScope searchScope = scope != null ? scope.getGlobalSearchScope() : GlobalSearchScope.allScope(project); + final RunConfigurationModule configurationModule = getConfiguration().getConfigurationModule(); + final Project project = configurationModule.getProject(); + final Module module = configurationModule.getModule(); + final GlobalSearchScope searchScope = module != null ? module.getModuleRuntimeScope(true) + : GlobalSearchScope.allScope(project); addClassesListToJavaParameters(myFailedTests, testInfo -> testInfo != null ? getTestPresentation(testInfo, project, searchScope) : null, data.getPackageName(), true, javaParameters); return javaParameters;