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).
Eclipse JUnit and Spock framework "Go To Test" does not work
-
09-07-2023 - |
Вопрос
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?
Решение
Другие советы
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
Не связан с StackOverflow