I am using the Spockframework/Groovy with eclipse(sts) and frequently run my Specs inside the IDE.

What really annoys me is that when I want to jump to a test method it doesn't work.

Does someone know a workaround for this limitation or an alternative?

GoToTest Not Working

有帮助吗?

解决方案

It's a known limitation of the Eclipse JUnit plugin. It can only jump to methods whose name does not contain spaces. There exists a long-standing improvement request to fix this (https://bugs.eclipse.org/bugs/show_bug.cgi?id=343129). Meanwhile, your options are to live with the status quo, to only use method names without spaces (not sure about other special characters), to contribute a fix to Eclipse, or to switch to an IDE that doesn't have this problem (such as IntelliJ IDEA).

其他提示

For now, the quick fix will be that you replace the spaces (' ') by an other character such as underscore ('_'). I just did it with two regEx using Eclipse's find and replace.

Step 1. Remove the whites spaces and replace with underscore

Find: (def "\w*)\s+

Replace with: $1_

(optional) Step 2. Remove method double quotes

Find: (def\s+\w*)"

Replace with: $1

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top