diff --git a/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java b/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java index dbf62b274a17..b4ef4ca15e78 100644 --- a/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java +++ b/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java @@ -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; }