Spock - Document -02 - Spock Primer】的更多相关文章

Spock Primer Peter Niederwieser, The Spock Framework TeamVersion 1.1 This chapter assumes that you have a basic knowledge of Groovy and unit testing. If you are a Java developer but haven’t heard about Groovy, don’t worry - Groovy will feel very fami…
Introduction Peter Niederwieser, The Spock Framework TeamVersion 1.1 Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language…
Modules Peter Niederwieser, The Spock Framework TeamVersion 1.1 Guice Module Integration with the Guice IoC container. For examples see the specs in the codebase. Spring Module The Spring module enables integration with Spring TestContext Framework.…
Extensions Peter Niederwieser, The Spock Framework TeamVersion 1.1 Spock comes with a powerful extension mechanism, which allows to hook into a spec’s lifecycle to enrich or alter its behavior. In this chapter, we will first learn about Spock’s built…
Interaction Based Testing Peter Niederwieser, The Spock Framework TeamVersion 1.1 Interaction-based testing is a design and testing technique that emerged in the Extreme Programming (XP) community in the early 2000’s. Focusing on the behavior of obje…
Data Driven Testing Peter Niederwieser, The Spock Framework TeamVersion 1.1 Oftentimes, it is useful to exercise the same test code multiple times, with varying inputs and expected results. Spock’s data driven testing support makes this a first class…
听说spock是一个加强版的Junit,今天特地安装了,再把过程给大家分享一下. 首先说明,我的Java项目是用maven管理的. 我用的Eclipse是Kelper,开普勒. 要使用Spock之前,首先要先把Groovy的环境配好.   上网搜了一下,找到了Groovy Eclipse插件的下载地址:   http://dist.springsource.org/snapshot/GRECLIPSE/e4.3/index.html   刚好这个安装包就是用于开普勒的. 更高级版本的Eclips…
转载:https://www.jianshu.com/p/f1e354d382cd Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring Boot项目中使用该框架写优雅.高效以及DSL化的测试用例.Spock通过@RunWith注解与JUnit框架协同使用,另外,Spock也可以和Mockito(Spring Boot应用的测试——Mockito)协同使用. 在这个小节中我们会利用Spock.Mockito一起编写一些测试用例(包括对C…
本文首发于个人网站:在Spring Boot项目中使用Spock测试框架 Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring Boot项目中使用该框架写优雅.高效以及DSL化的测试用例.Spock通过@RunWith注解与JUnit框架协同使用,另外,Spock也可以和Mockito(Spring Boot应用的测试--Mockito)一起使用. 在这个小节中我们会利用Spock.Mockito一起编写一些测试用例(包括对Contro…
目录 Spock测试套件 核心概念 整体认识 前置.后置 同junit的类比 Feature 方法 blocks 典型的用法 异常condition then和expect的区别 cleanup block的用法 测试用例中的文本描述 Extension 数据驱动测试 数据表 另外的写法 更清晰的测试结果展示 更丰富的数据准备方式 基于交互的测试(Interaction Based Testing) 对依赖Mock的调用期望,其结构如下 一些通配符 严格模式(Strict Mocking) 调用…