如何在Grails上运行Spock集成测试



我的项目的技术堆栈是Grails 3.2.3,Groovy 2.4.7,Gradle 3.2.1,GORM和IDE是Intellij,后端是MongoDB。我已经实现了 Spock Integraction 测试类 TestControllerSpec,并希望运行单个 Spock 集成测试运行单个测试用例需要哪些配置更改以及如何更改?

@Integration
@Rollback
class TestControllerSpec extends Specification {
    @Unroll
    void "temp listObjects"(){        
        def result   
        def params = [id:  '123']
        when:
        result = controller.index(10)
        then:
        result == null
        result.size()==0
    }
}

使用命令行:

grails test-app -integration

或对于特定测试:

grails test-app com.best.company.BestTestClass -integration

最新更新