Grails 在集成测试中获取testname

Grails 在集成测试中获取testname,grails,groovy,Grails,Groovy,在grails集成测试中,如何获取当前正在执行的测试名称 我想这样做是为了记录日志 使用JUnit的@规则TestName。这适用于旧式JUnit测试和spock规范 例如: import spock.lang.Specification import org.junit.Rule import org.junit.rules.TestName class MyTestSpec extends Specification { @Rule TestName name = new Test

在grails集成测试中,如何获取当前正在执行的测试名称


我想这样做是为了记录日志

使用JUnit的
@规则TestName
。这适用于旧式JUnit测试和spock规范

例如:

import spock.lang.Specification
import org.junit.Rule
import org.junit.rules.TestName

class MyTestSpec extends Specification {
    @Rule TestName name = new TestName()

    void "test something"() {
        setup:
        println "running $name.methodName"
        ....
    }
}
可能是一个复制品