mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-139154 Gradle Single Test Prints "Empty test suite."; IDEA-146601 Gradle: blinking non-relevant tests
This commit is contained in:
+10
@@ -33,6 +33,7 @@ public class GradleSMTestProxy extends SMTestProxy {
|
||||
|
||||
@Nullable private final String myClassName;
|
||||
@Nullable private String myStacktrace;
|
||||
@Nullable private String myParentId;
|
||||
|
||||
public GradleSMTestProxy(String testName, boolean isSuite, @Nullable String locationUrl, @Nullable String className) {
|
||||
super(testName, isSuite, locationUrl);
|
||||
@@ -78,6 +79,15 @@ public class GradleSMTestProxy extends SMTestProxy {
|
||||
return super.getLocation(project, searchScope);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getParentId() {
|
||||
return myParentId;
|
||||
}
|
||||
|
||||
public void setParentId(@Nullable String parentId) {
|
||||
myParentId = parentId;
|
||||
}
|
||||
|
||||
private void setStacktraceIfNotSet(@Nullable String stacktrace) {
|
||||
if (myStacktrace == null) myStacktrace = stacktrace;
|
||||
}
|
||||
|
||||
+10
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.execution.test.runner.events;
|
||||
|
||||
import com.intellij.execution.testframework.sm.runner.SMTestProxy;
|
||||
import com.intellij.execution.testframework.sm.runner.ui.SMTestRunnerResultsForm;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -79,4 +80,13 @@ public abstract class AbstractTestEvent implements TestEvent {
|
||||
protected void addToInvokeLater(final Runnable runnable) {
|
||||
ExternalSystemApiUtil.addToInvokeLater(runnable);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected SMTestProxy findTestProxy(final String proxyId) {
|
||||
return getConsoleManager().getTestsMap().get(proxyId);
|
||||
}
|
||||
|
||||
protected void registerTestProxy(final String proxyId, SMTestProxy testProxy) {
|
||||
getConsoleManager().getTestsMap().put(proxyId, testProxy);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -36,7 +36,7 @@ public class AfterSuiteEvent extends AbstractTestEvent {
|
||||
addToInvokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final SMTestProxy testProxy = getConsoleManager().getTestsMap().get(testId);
|
||||
final SMTestProxy testProxy = findTestProxy(testId);
|
||||
if (testProxy == null) return;
|
||||
|
||||
switch (result) {
|
||||
@@ -53,9 +53,6 @@ public class AfterSuiteEvent extends AbstractTestEvent {
|
||||
break;
|
||||
}
|
||||
|
||||
if (testProxy.isEmptySuite() && !(testProxy instanceof SMTestProxy.SMRootTestProxy)) {
|
||||
testProxy.getParent().getChildren().remove(testProxy);
|
||||
}
|
||||
getResultsViewer().onSuiteFinished(testProxy);
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class AfterTestEvent extends AbstractTestEvent {
|
||||
final String exceptionMsg = eventXml.queryXml("/ijLog/event/test/result/errorMsg");
|
||||
final String stackTrace = eventXml.queryXml("/ijLog/event/test/result/stackTrace");
|
||||
|
||||
final SMTestProxy testProxy = getConsoleManager().getTestsMap().get(testId);
|
||||
final SMTestProxy testProxy = findTestProxy(testId);
|
||||
if (testProxy == null) return;
|
||||
|
||||
try {
|
||||
|
||||
+5
-14
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.execution.test.runner.events;
|
||||
|
||||
import com.intellij.execution.testframework.sm.runner.SMTestProxy;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleSMTestProxy;
|
||||
import org.jetbrains.plugins.gradle.util.XmlXpathHelper;
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleTestsExecutionConsoleManager;
|
||||
|
||||
@@ -37,24 +37,15 @@ public class BeforeSuiteEvent extends AbstractTestEvent {
|
||||
final String fqClassName = getTestClassName(eventXml);
|
||||
|
||||
if (StringUtil.isEmpty(parentTestId)) {
|
||||
getConsoleManager().getTestsMap().put(testId, getResultsViewer().getTestsRootNode());
|
||||
registerTestProxy(testId, getResultsViewer().getTestsRootNode());
|
||||
}
|
||||
else {
|
||||
String locationUrl = findLocationUrl(null, fqClassName);
|
||||
final SMTestProxy testProxy = new SMTestProxy(name, true, locationUrl);
|
||||
final GradleSMTestProxy testProxy = new GradleSMTestProxy(name, true, locationUrl, null);
|
||||
testProxy.setLocator(getConsoleManager().getUrlProvider());
|
||||
testProxy.setParentId(parentTestId);
|
||||
testProxy.setStarted();
|
||||
getConsoleManager().getTestsMap().put(testId, testProxy);
|
||||
final SMTestProxy parentTestProxy = getConsoleManager().getTestsMap().get(parentTestId);
|
||||
if (parentTestProxy != null) {
|
||||
addToInvokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
parentTestProxy.addChild(testProxy);
|
||||
getResultsViewer().onSuiteStarted(testProxy);
|
||||
}
|
||||
});
|
||||
}
|
||||
registerTestProxy(testId, testProxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-3
@@ -17,9 +17,12 @@ package org.jetbrains.plugins.gradle.execution.test.runner.events;
|
||||
|
||||
import com.intellij.execution.testframework.sm.runner.SMTestProxy;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.plugins.gradle.util.XmlXpathHelper;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleSMTestProxy;
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleTestsExecutionConsoleManager;
|
||||
import org.jetbrains.plugins.gradle.util.XmlXpathHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
@@ -43,7 +46,7 @@ public class BeforeTestEvent extends AbstractTestEvent {
|
||||
|
||||
testProxy.setStarted();
|
||||
testProxy.setLocator(getConsoleManager().getUrlProvider());
|
||||
getConsoleManager().getTestsMap().put(testId, testProxy);
|
||||
registerTestProxy(testId, testProxy);
|
||||
|
||||
if (StringUtil.isEmpty(parentTestId)) {
|
||||
addToInvokeLater(new Runnable() {
|
||||
@@ -54,11 +57,28 @@ public class BeforeTestEvent extends AbstractTestEvent {
|
||||
});
|
||||
}
|
||||
else {
|
||||
final SMTestProxy parentTestProxy = getConsoleManager().getTestsMap().get(parentTestId);
|
||||
final SMTestProxy parentTestProxy = findTestProxy(parentTestId);
|
||||
if (parentTestProxy != null) {
|
||||
addToInvokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final List<GradleSMTestProxy> notYetAddedParents = ContainerUtil.newSmartList();
|
||||
SMTestProxy currentParentTestProxy = parentTestProxy;
|
||||
while (currentParentTestProxy != null && currentParentTestProxy instanceof GradleSMTestProxy) {
|
||||
final String parentId = ((GradleSMTestProxy)currentParentTestProxy).getParentId();
|
||||
if (currentParentTestProxy.getParent() == null && parentId != null) {
|
||||
notYetAddedParents.add((GradleSMTestProxy)currentParentTestProxy);
|
||||
}
|
||||
currentParentTestProxy = findTestProxy(parentId);
|
||||
}
|
||||
|
||||
for (GradleSMTestProxy gradleSMTestProxy : ContainerUtil.reverse(notYetAddedParents)) {
|
||||
final SMTestProxy parentTestProxy = findTestProxy(gradleSMTestProxy.getParentId());
|
||||
if (parentTestProxy != null) {
|
||||
parentTestProxy.addChild(gradleSMTestProxy);
|
||||
getResultsViewer().onSuiteStarted(gradleSMTestProxy);
|
||||
}
|
||||
}
|
||||
parentTestProxy.addChild(testProxy);
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class OnOutputEvent extends AbstractTestEvent {
|
||||
final String destination = eventXml.queryXml("/ijLog/event/test/event/@destination");
|
||||
final String output = eventXml.queryXml("/ijLog/event/test/event");
|
||||
|
||||
SMTestProxy testProxy = getConsoleManager().getTestsMap().get(testId);
|
||||
SMTestProxy testProxy = findTestProxy(testId);
|
||||
if (testProxy == null) return;
|
||||
|
||||
testProxy.addStdOutput(output, "StdOut".equals(destination) ? ProcessOutputTypes.STDOUT : ProcessOutputTypes.STDERR);
|
||||
|
||||
Reference in New Issue
Block a user