【发布时间】:2020-01-09 09:33:35
【问题描述】:
我目前正在尝试测试应用程序以在设置属性时正确启动。 基本上是对配置和自动装配的测试。我不想执行任何 bean,只想启动系统。
我对 groovy 2.5.8 和 spock 1.3-groovy2.5 的尝试:
@ActiveProfiles([MY_PROFILES])
@WebAppConfiguration
@ContextConfiguration
@SpringBootTest(classes = [Application], properties = ["property.enabled=true"])
class IntegrationTest extends Specification {
def "Service starts up with property enabled"() {
expect:
noExceptionThrown()
}
}
不幸的是,我收到以下编译错误:Error:(23, 5) Groovyc: Exception conditions are only allowed in 'then' blocks
有人知道我还能如何通过这个测试吗?
【问题讨论】:
标签: spring-boot groovy integration-testing spock