How to get name of currently running test in spock?

后端 未结 2 855
[愿得一人]
[愿得一人] 2021-01-17 10:02

In JUnit 3, I could get the name of the currently running test like this:

public class MyTest extends TestCase {
    public void testSomething() {
        as         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-17 10:04

    For spock 1.0-groovy-2.4 you can try :

    def "Simple test"() {
    
        expect:
        specificationContext.currentIteration.name == "Simple test"
    }
    

提交回复
热议问题