Spock测试的双引号测试名称中的单引号导致';意外标记';,但仅当与gradle一起运行并作为独立测试时

Spock测试的双引号测试名称中的单引号导致';意外标记';,但仅当与gradle一起运行并作为独立测试时,gradle,intellij-idea,groovy,spock,geb,Gradle,Intellij Idea,Groovy,Spock,Geb,我刚刚安装了intellij并下载了geb示例等级()。在Intellij设置中,我在gradle/runner:runtest下配置了:让我选择每个测试。然后我和gradle一起运行了测试“可以访问当前的Geb书籍”,它运行得很好,运行GebishOrgSpec类也很好。然后,我在测试的methodname中添加了一个引号,即“can'gettothecurrentbookofgeb”。使用gradle运行GebishOrgSpec类(包含该测试)仍然可以正常工作。但是,当我使用gradle运

我刚刚安装了intellij并下载了geb示例等级()。在Intellij设置中,我在gradle/runner:runtest下配置了:让我选择每个测试。然后我和gradle一起运行了测试“可以访问当前的Geb书籍”,它运行得很好,运行GebishOrgSpec类也很好。然后,我在测试的methodname中添加了一个引号,即“can'gettothecurrentbookofgeb”。使用gradle运行GebishOrgSpec类(包含该测试)仍然可以正常工作。但是,当我使用gradle运行测试时(即,在运行菜单中的Alt-Shift-F10之后,我选择了“GebishOrgSpec.can'get to the current Book of Geb”instahead of“GebishOrgSpec”),我得到以下错误:

FAILURE: Build failed with an exception.
* Where:
Initialization script '/tmp/ijtestinit3.gradle' line: 6
* What went wrong:
Could not compile initialization script '/tmp/ijtestinit3.gradle'.
> startup failed:
  initialization script '/tmp/ijtestinit3.gradle': 6: unexpected token: get @ line 6, column 49.
     ludes = ['GebishOrgSpec.can ' get to the
                                   ^
  1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Cause: startup failed:
initialization script '/tmp/ijtestinit3.gradle': 6: unexpected token: get @ line 6, column 49.
   ludes = ['GebishOrgSpec.can ' get to the
                                 ^
1 error
我还尝试使用Junit运行测试(在设置驱动程序路径之后),这也很好。对我来说,在运行类时使用相同的测试,但在运行类的方法时不使用相同的测试,这是毫无意义的。下面是完整的课程代码:

import geb.spock.GebSpec
class GebishOrgSpec extends GebSpec {
        def "can ' get to the current Book of Geb"() {
        when:
        to GebishOrgHomePage

        and:
        manualsMenu.open()

        then:
        manualsMenu.links[0].text().startsWith("current")

        when:
        manualsMenu.links[0].click()

        then:
        at TheBookOfGebPage
    }
}

更新:我在两台不同的计算机上有过这种行为,但如果其他人也测试一下,我将不胜感激。它应该很容易复制(如果上面的描述有问题,让我知道。)也许你不会有错误,我有一些错误的配置,或者你可以确认这个错误,我们会引起注意。

我在IntelliJ 2018.1.1中通过了测试,运行类或单个测试。@jaco0646您是否使用gradle运行了测试?对于junit,它也适用于我,但我需要使用gradle作为测试的运行程序。