You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run Java unit tests, I can double-click an entry from the "Junit" results view to go to the test method represented in the results view.
However, when the test is based on Spock, which I assume would be handled by this plugin, it appears the algorithm used to determine the method name is not "Groovy-able". It appears that it only takes the first word of the method name, and stops at the first space. Groovy method names can be quoted strings with spaces, which is what is typically done with Spock spec methods. The result is an error dialog which says "Method 'xxx' not found. Opening the test class.".
The text was updated successfully, but these errors were encountered:
This error comes from Eclipse JDT's JUnit support itself.
The problem could be fixable by Eclipse, for methods like def "test that blah"() since it assumes that test methods meet Java naming standards. Perhaps that's where we should be reporting this.
However, for tests using @unroll with string formats, the issue can't really be fixed since the testcase method's name is not reported in the JUnit results, only the testcase's name.
The problem starts in OpenTestAction, which truncates method name before first non-identifier character. You will need to follow up with the JDT bug to get resolution.
privatestaticStringextractRealMethodName(TestCaseElementtestCase) {
//workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=334864 :if (testCase.isIgnored() && JavaConventions.validateJavaTypeName(testCase.getTestName(), JavaCore.VERSION_1_5, JavaCore.VERSION_1_5).getSeverity() != IStatus.ERROR) {
returnnull;
}
//workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=275308 :StringtestMethodName= testCase.getTestMethodName();
for (inti= 0; i < testMethodName.length(); i++) {
if (!Character.isJavaIdentifierPart(testMethodName.charAt(i))) {
returntestMethodName.substring(0, i);
}
}
returntestMethodName;
}
When I run Java unit tests, I can double-click an entry from the "Junit" results view to go to the test method represented in the results view.
However, when the test is based on Spock, which I assume would be handled by this plugin, it appears the algorithm used to determine the method name is not "Groovy-able". It appears that it only takes the first word of the method name, and stops at the first space. Groovy method names can be quoted strings with spaces, which is what is typically done with Spock spec methods. The result is an error dialog which says "Method 'xxx' not found. Opening the test class.".
The text was updated successfully, but these errors were encountered: