Submit Search
Upload
单元测试(Unit Test)- Spock应用
•
1 like
•
246 views
诸
诸葛修车网-诸葛商城
Follow
测试可以增加对程序的理解,可以提供编程水平,实现编写可测试的代码。通过spock可以实现无依赖测试,提高质量和效率
Read less
Read more
Technology
Report
Share
Report
Share
1 of 79
Download now
Download to read offline
Recommended
Free youtubedownload log
Free youtubedownload log
aracely-lahermosa
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected Journey
Oren Farhi
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Moldova ICT Summit
Automated Abstraction of Flow of Control in a System of Distributed Software...
Automated Abstraction of Flow of Control in a System of Distributed Software...
nimak
GWT Introduction and Overview - SV Code Camp 09
GWT Introduction and Overview - SV Code Camp 09
Fred Sauer
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwt
supertoy2015
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
OSGi and Eclipse RCP
OSGi and Eclipse RCP
Eric Jain
Recommended
Free youtubedownload log
Free youtubedownload log
aracely-lahermosa
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected Journey
Oren Farhi
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Moldova ICT Summit
Automated Abstraction of Flow of Control in a System of Distributed Software...
Automated Abstraction of Flow of Control in a System of Distributed Software...
nimak
GWT Introduction and Overview - SV Code Camp 09
GWT Introduction and Overview - SV Code Camp 09
Fred Sauer
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwt
supertoy2015
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
OSGi and Eclipse RCP
OSGi and Eclipse RCP
Eric Jain
Browser testing with nightwatch.js - Drupal Europe
Browser testing with nightwatch.js - Drupal Europe
Salvador Molina (Slv_)
Game development with_lib_gdx
Game development with_lib_gdx
Gabriel Grill
20190627 j hipster-conf- diary of a java dev lost in the .net world
20190627 j hipster-conf- diary of a java dev lost in the .net world
Daniel Petisme
Node.js at Joyent: Engineering for Production
Node.js at Joyent: Engineering for Production
jclulow
IQ_final_ppt
IQ_final_ppt
Sovik Guha Biswas
Spring 4 final xtr_presentation
Spring 4 final xtr_presentation
sourabh aggarwal
Security testing of YUI powered applications
Security testing of YUI powered applications
dimisec
Testing Experience Magazine Vol.12 Dec 2010
Testing Experience Magazine Vol.12 Dec 2010
MIMOS Berhad/Open University Malaysia/Universiti Teknologi Malaysia
Javaee6 Overview
Javaee6 Overview
Carol McDonald
Android Capstone Project, Final Deliverable Documentation
Android Capstone Project, Final Deliverable Documentation
Nate Betz
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Red Hat Developers
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Peter Pilgrim
05 optimization of cocos2d-x games on x86 architecture
05 optimization of cocos2d-x games on x86 architecture
乐费 胡
Enterprise Java Puzzlers
Enterprise Java Puzzlers
Pavel Grushetzky
Beyond the basics of SonarQube: improve your Java(Script) code even further
Beyond the basics of SonarQube: improve your Java(Script) code even further
Johan Janssen
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
DroidConTLV
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch
GroovyServ - Technical Part
GroovyServ - Technical Part
Yasuharu Nakano
Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019
Matt Raible
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
Ben Hall
组合、备忘录、建造者模式、原型
组合、备忘录、建造者模式、原型
诸葛修车网-诸葛商城
设计模式-单例、享元、工厂与抽象工厂
设计模式-单例、享元、工厂与抽象工厂
诸葛修车网-诸葛商城
More Related Content
Similar to 单元测试(Unit Test)- Spock应用
Browser testing with nightwatch.js - Drupal Europe
Browser testing with nightwatch.js - Drupal Europe
Salvador Molina (Slv_)
Game development with_lib_gdx
Game development with_lib_gdx
Gabriel Grill
20190627 j hipster-conf- diary of a java dev lost in the .net world
20190627 j hipster-conf- diary of a java dev lost in the .net world
Daniel Petisme
Node.js at Joyent: Engineering for Production
Node.js at Joyent: Engineering for Production
jclulow
IQ_final_ppt
IQ_final_ppt
Sovik Guha Biswas
Spring 4 final xtr_presentation
Spring 4 final xtr_presentation
sourabh aggarwal
Security testing of YUI powered applications
Security testing of YUI powered applications
dimisec
Testing Experience Magazine Vol.12 Dec 2010
Testing Experience Magazine Vol.12 Dec 2010
MIMOS Berhad/Open University Malaysia/Universiti Teknologi Malaysia
Javaee6 Overview
Javaee6 Overview
Carol McDonald
Android Capstone Project, Final Deliverable Documentation
Android Capstone Project, Final Deliverable Documentation
Nate Betz
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Red Hat Developers
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Peter Pilgrim
05 optimization of cocos2d-x games on x86 architecture
05 optimization of cocos2d-x games on x86 architecture
乐费 胡
Enterprise Java Puzzlers
Enterprise Java Puzzlers
Pavel Grushetzky
Beyond the basics of SonarQube: improve your Java(Script) code even further
Beyond the basics of SonarQube: improve your Java(Script) code even further
Johan Janssen
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
DroidConTLV
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch
GroovyServ - Technical Part
GroovyServ - Technical Part
Yasuharu Nakano
Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019
Matt Raible
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
Ben Hall
Similar to 单元测试(Unit Test)- Spock应用
(20)
Browser testing with nightwatch.js - Drupal Europe
Browser testing with nightwatch.js - Drupal Europe
Game development with_lib_gdx
Game development with_lib_gdx
20190627 j hipster-conf- diary of a java dev lost in the .net world
20190627 j hipster-conf- diary of a java dev lost in the .net world
Node.js at Joyent: Engineering for Production
Node.js at Joyent: Engineering for Production
IQ_final_ppt
IQ_final_ppt
Spring 4 final xtr_presentation
Spring 4 final xtr_presentation
Security testing of YUI powered applications
Security testing of YUI powered applications
Testing Experience Magazine Vol.12 Dec 2010
Testing Experience Magazine Vol.12 Dec 2010
Javaee6 Overview
Javaee6 Overview
Android Capstone Project, Final Deliverable Documentation
Android Capstone Project, Final Deliverable Documentation
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
05 optimization of cocos2d-x games on x86 architecture
05 optimization of cocos2d-x games on x86 architecture
Enterprise Java Puzzlers
Enterprise Java Puzzlers
Beyond the basics of SonarQube: improve your Java(Script) code even further
Beyond the basics of SonarQube: improve your Java(Script) code even further
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
GroovyServ - Technical Part
GroovyServ - Technical Part
Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
More from 诸葛修车网-诸葛商城
组合、备忘录、建造者模式、原型
组合、备忘录、建造者模式、原型
诸葛修车网-诸葛商城
设计模式-单例、享元、工厂与抽象工厂
设计模式-单例、享元、工厂与抽象工厂
诸葛修车网-诸葛商城
面向对象设计原则
面向对象设计原则
诸葛修车网-诸葛商城
Maven技术及诸葛商城应用(1)
Maven技术及诸葛商城应用(1)
诸葛修车网-诸葛商城
Push-推送技术
Push-推送技术
诸葛修车网-诸葛商城
Sonar java -Write Clean Code,Detect Bugs
Sonar java -Write Clean Code,Detect Bugs
诸葛修车网-诸葛商城
Nginx+tomcat https 配置
Nginx+tomcat https 配置
诸葛修车网-诸葛商城
如何更好地设计测试用例-BQConf
如何更好地设计测试用例-BQConf
诸葛修车网-诸葛商城
App开发过程的演变之路
App开发过程的演变之路
诸葛修车网-诸葛商城
浅谈项目管理(诸葛B2B电商研发部版改)
浅谈项目管理(诸葛B2B电商研发部版改)
诸葛修车网-诸葛商城
Java多线程技术
Java多线程技术
诸葛修车网-诸葛商城
Git基础培训
Git基础培训
诸葛修车网-诸葛商城
More from 诸葛修车网-诸葛商城
(12)
组合、备忘录、建造者模式、原型
组合、备忘录、建造者模式、原型
设计模式-单例、享元、工厂与抽象工厂
设计模式-单例、享元、工厂与抽象工厂
面向对象设计原则
面向对象设计原则
Maven技术及诸葛商城应用(1)
Maven技术及诸葛商城应用(1)
Push-推送技术
Push-推送技术
Sonar java -Write Clean Code,Detect Bugs
Sonar java -Write Clean Code,Detect Bugs
Nginx+tomcat https 配置
Nginx+tomcat https 配置
如何更好地设计测试用例-BQConf
如何更好地设计测试用例-BQConf
App开发过程的演变之路
App开发过程的演变之路
浅谈项目管理(诸葛B2B电商研发部版改)
浅谈项目管理(诸葛B2B电商研发部版改)
Java多线程技术
Java多线程技术
Git基础培训
Git基础培训
Recently uploaded
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Alan Dix
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
Softradix Technologies
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
null - The Open Security Community
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
null - The Open Security Community
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
OnBoard
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
Neo4j
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Mattias Andersson
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Patryk Bandurski
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Malak Abu Hammad
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
Enterprise Knowledge
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Memoori
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
Deakin University
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
Kalema Edgar
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
carlostorres15106
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Padma Pradeep
Recently uploaded
(20)
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
单元测试(Unit Test)- Spock应用
1.
52T @@ SS U
5 .6 1 64
2.
D 76 3 46
3.
4.
5.
6.
7.
8.
, Unit Testing
9.
10.
bug, bug
11.
-- --
12.
--
13.
14.
BUG “ ” 1 2
15.
16.
17.
18.
1. user 2. dao
update 3. true/false
19.
1. dao update
true 2. service update 3. service true
20.
UserService: userDao.update(userBean) UserServiceTest Given: userDao.update(userBean)>>true When: boolean result =
userService.update(userDto); Then: result
21.
UserService: userDao.update(userBean) UserServiceTest Given: userDao.update(userBean)>>true When: boolean result =
userService.update(userDto); Then: result
22.
A
23.
“ ”
24.
D
25.
BUG
26.
27.
mock Given,When,Then IDE,
28.
76 3
29.
SPOCK SPOCK Java Groovy Groovy specification language junit
runner junit JUnit jMock RSpec Groovy Scala spockframework
30.
Groovy Groovy jvm java API
31.
specification language specification language specification
BDD Behavior-driven development “ ” Given-When- Then spockframework
32.
SPOCK UserService.isUserEnabled(uid) UserService.isUserEnabled: UserInfo userInfo =
userDao.get(uid); return userInfo.getStatus()==UserInfo.ENABLED
33.
SPOCK UserServiceSpec.groovy
34.
SPOCK SPOCK spock groovy jUnit
35.
SPOCK SPOCK groovy java
36.
SPOCK SPOCK groovy java SPOCK spock
37.
SPOCK Specification Fields Fixture Methods blocks
38.
SPOCK Specification Fields Spock (system under
test; SUT) (specification) Spock Specification Specification setup()
39.
SPOCK Fixture Methods junit testng
40.
SPOCK blocks feature method block
block block
41.
SPOCK blocks setup / given
block when ... then … when then when then expert expect when+then
42.
SPOCK blocks thrown thrown()
43.
SPOCK blocks thrown
44.
SPOCK blocks notThrown notThrown()
45.
SPOCK blocks cleanup
46.
SPOCK blocks where: xml data provider
47.
SPOCK blocks where:
48.
SPOCK blocks where: Spock
49.
SPOCK blocks where: Spock @Unroll,
50.
NotImplementedError!
51.
52.
they It’s time to
weChat
53.
SPOCK Test Double
54.
Test Double http://xunitpatterns.com/
55.
Test Double http://xunitpatterns.com/
56.
SPOCK blocks mock: Spock mock
57.
SPOCK blocks mock: Mock
58.
SPOCK blocks mock: groovy
59.
SPOCK blocks stub: mock subscriber.receive(_) >> "ok" subscriber.receive(_)
>>> ["ok", "error", "error", "ok"] subscriber.receive(_) >> { throw new InternalError("ouch") }
60.
46
61.
62.
A B C
63.
Feature
64.
maven spring 4.3+, spring-test,
groovy-all, spock-spring, spock- core, cglib-nodep,spock-reports test groovy pom testSourceDir=test/groovy src/main/resources META-INF/services, com.athaydes.spockframework.report.IReportCreator.properties com.athaydes.spockframework.report.outputDir=target/spock- reports, html
65.
maven
66.
DB
67.
Feature
68.
Feature -
69.
Feature - request bean response
70.
- setup: ImageCaptchaServiceImpl
71.
- request
72.
- captchaCode
73.
-
74.
-
75.
76.
77.
78.
Test Coverage http://www.infoq.com
79.
http://git.zgxcw.com/b2b/classroom/wikis/ -
Download now