我正在开发spring boot应用程序.我必须为它编写测试用例.我以前没有写过测试用例,所以有人建议使用spock框架.我探索了spock,我认为它与groovy语言更相关.
我可以为我的春季应用程序编写spock测试用例吗?
如果是这样,那么你能否建议我更好地记录“如何在春季启动应用程序中使用它”?
查看official documentation,了解使用Spring Boot进行Spock测试的示例
35.3.1 Using Spock to test Spring Boot applications
一个简单的谷歌搜索揭示了Using Spock to test Spring classes的基本示例.
Spock relies heavily on the Spring’s TestContext framework and does
this via the @ContextConfiguration annotation. This allows the test
specification class to load an application context from one or more
locations.
Spring One g2x有一篇关于使用Spock测试Java,Groovy,Spring和Web应用程序的大型演示文稿.
Groovy和Java可以自由混合在一起,您可以使用任何您喜欢的基于Java的库,或使用基于Groovy的库.
The Spring framework supports Groovy and – not surprisingly – Spring
TestContext framework works well with Spock Spock specifications can
be run from an IDE just like normal JUnit tests and,last but not
least,implementing them is a great opportunity to learn the Groovy
language.source
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。