更改autoGenerating Grails的测试脚手架斯波克测试
问题描述:
你好我尝试改变自动生成测试用例Grails中更改autoGenerating Grails的测试脚手架斯波克测试
@TestMixin(GrailsUnitTestMixin)
class KLAKSpec {
void setUp() {
// Setup logic here
}
void tearDown() {
// Tear down logic here
}
void testSomething() {
fail "Implement me"
}
}
到斯波克型式试验格式,它是这样的
@TestFor(GrailsUnitTestCase)
class @[email protected] extends @[email protected] {
def "feature method"() {
setup:
when:
then:
where:
}
}
Althought我有在scipt文件夹下添加一个_Events.groovy脚本,并在artifacts文件夹中添加一个Spec.groovy文件,该文件夹在我自动生成列表时更改名称。
任何人都可以请让我知道我可以如何改变规格格式。
答
我前一段时间写了一篇博文:Auto-generate Spock specs for Grails artifacts。这篇文章是在Grails 2之前编写的,所以它仍然使用旧的超类而不是@TestFor
,但它应该很容易适应。我们仍然在Grails 1.3.7上使用这个技术。由于Grails没有为测试生成揭示独特的事件,但它工作得很好,这是一个简单的工具。