spring-spock-integration-testing:如何将Spock模拟注入到Spring集成测试中

时间:2021-05-16 05:44:18
【文件属性】:
文件名称:spring-spock-integration-testing:如何将Spock模拟注入到Spring集成测试中
文件大小:67KB
文件格式:ZIP
更新时间:2021-05-16 05:44:18
spring-boot spock spock-framework Groovy 如何将Spock模拟注入到Spring集成测试中 该项目旨在用作示例指南,以说明如何将Spock与Spring(和Spring Boot)结合使用,并结合使用Spring配置和Spock模拟。 有时,您想使用整个Spring上下文进行更完整的集成测试。 这通常会导致您宁愿嘲笑的少数问题点。 在Spring Boot 1.4中,他们引入了很多很酷的测试玩具,包括@MockBean 。 遗憾的是,仅在使用JUnit进行测试时才支持。 值得庆幸的是,Spock 1.1引入了DetachedMockFactory 。 结合新的Spring Boot @TestConfiguration您可以提高测试的幸福感。 这个例子的核心存在于我们的PersonControllerIntTest 。 PersonControllerIntTest启动了Spring上下文,因此我们可以对REST端点进行M
【文件预览】:
spring-spock-integration-testing-master
----.travis.yml(185B)
----gradlew.bat(2KB)
----gradlew(5KB)
----gradle()
--------wrapper()
----src()
--------test()
--------main()
----.gitignore(282B)
----README.md(1KB)
----build.gradle(1KB)

网友评论