Spock测试:Eclipse不';似乎没有重新组织Where子句中的数据变量

Spock测试:Eclipse不';似乎没有重新组织Where子句中的数据变量,eclipse,groovy,spock,Eclipse,Groovy,Spock,我有一个使用where子句的Spock测试。在Eclipse中,测试文件是用Groovy编辑器打开的,但是代码(“testName”)和where子句(testNum和testName)中的数据变量都带有下划线。maven构建工作正常 有人能告诉我如何在Eclipse中解决这个问题吗 @Unroll def 'Test #testNum'() { def tname = testName ...... where: testNum

我有一个使用
where
子句的Spock测试。在Eclipse中,测试文件是用Groovy编辑器打开的,但是代码(“testName”)和
where
子句(testNum和testName)中的数据变量都带有下划线。maven构建工作正常

有人能告诉我如何在Eclipse中解决这个问题吗

  @Unroll
  def 'Test #testNum'() {
      def tname = testName

      ......

      where:
         testNum  |  testName
          '1'     | 'test #1'
  }

我有很长一段时间没有使用Eclipse,但是定义测试参数对Eclipse来说可能不那么容易混淆:

@Unroll
def 'Test #testNum'(String testNum, String testName) {

    def tname = testName

    ......

    where:
    testNum  |  testName
    '1'      | 'test #1'
}

我可以通过运行Spock转换来消除下划线,并将其添加到eclipse.ini的末尾:

-Dgreclipse.globalTransformsInReconcile=org.spockframework.compiler.SpockTransform
但是,testName的推断类型是Object(请参见另一个答案下的注释)


你不能。。。IntelliJ能识别它们,但Eclipse不能识别t@tim_yates非常感谢。我希望Eclipse能为它提供一个插件。Spock transform动态地将AST更新为“def'Test#testNum'(Object testNum,Object testName){”,所以我建议@Michael建议获取字符串的类型完成。