mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
testng: name different invocations of tests differently as concurrent execution could break protocol otherwise (IDEA-140265)
This commit is contained in:
@@ -63,10 +63,21 @@ public class IDEATestNGRemoteListener implements ISuiteListener, IResultListener
|
||||
invocationCount = myInvocationCount;
|
||||
myMap.put(result, invocationCount);
|
||||
}
|
||||
onTestStart(getTestHierarchy(result), testMethodName, parameters.length > 0 ? "[" + getParamsString(parameters) + "]" : null, invocationCount);
|
||||
final String paramString = parameters.length > 0 || invocationCount > 0
|
||||
? "[" + getParamsSpace(invocationCount, parameters) + getParamsString(parameters) + "]"
|
||||
: null;
|
||||
onTestStart(getTestHierarchy(result), testMethodName,
|
||||
paramString, invocationCount);
|
||||
myInvocationCount++;
|
||||
}
|
||||
|
||||
public static String getParamsSpace(Integer invocationCount, Object[] parameters) {
|
||||
if (invocationCount > 0) {
|
||||
return invocationCount + (parameters.length > 0 ? " " : "");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public synchronized void onTestSuccess(ITestResult result) {
|
||||
onTestFinished(getTestMethodNameWithParams(result));
|
||||
}
|
||||
@@ -203,11 +214,16 @@ public class IDEATestNGRemoteListener implements ISuiteListener, IResultListener
|
||||
"\' locationHint=\'java:test://" + escapeName(className + "." + methodName + ( invocationCount >= 0 ? "[" + invocationCount + "]" : "")) + "\']");
|
||||
}
|
||||
|
||||
private static String getTestMethodNameWithParams(ITestResult result) {
|
||||
private synchronized String getTestMethodNameWithParams(ITestResult result) {
|
||||
String methodName = getTestMethodName(result);
|
||||
final Object[] parameters = result.getParameters();
|
||||
if (parameters.length > 0) {
|
||||
methodName += "[" + getParamsString(parameters) + "]";
|
||||
Integer invocationCount = myMap.get(result);
|
||||
if (parameters.length > 0 || invocationCount != null && invocationCount > 0) {
|
||||
methodName += "[";
|
||||
if (invocationCount != null) {
|
||||
methodName += getParamsSpace(invocationCount, parameters);
|
||||
}
|
||||
methodName += getParamsString(parameters) + "]";
|
||||
}
|
||||
return methodName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user