我目前正在尝试设置属性后测试应用程序是否可以正确启动。基本上是对配置和自动装配的测试。我不想执行任何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
有人知道我还能如何通过此测试吗?
删除noExceptionThrown
应该会有所帮助。这应该工作:
def "Service starts up with property enabled"() {
expect: "All beans are created"
}