02s0404浅度测试-可伸缩的TDDBDD
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Quote Pricin g!
! …
BusRul e Validat or! BR1 BR2 BRN
! …
Doma in Model!
Repository!
PRICING DATA
Age Restriction Rule!
Error Handler!
Validation s!
Pricer!
JSON
h#p://clipboarded.blogspot.com!
Error Handler!
Validation s!
Pricer!
JSON
Validat or!
Mandator y Validator!
Controll er!
Price Calculat or!
Cover 1 Cover 2
BDD
!
Concept Tools/
!
Current Practices
!
web_steps.rb!
h#p://blog.carbonfive.com/2011/11/07/modernPcucumberPandPrailsPnoPmorePtrainingPwheels/!
Simulate Http
Customers should be given the right insurance premium based on their insurance requirements
High level and Test Journeys at the UI Le
An authenticated insurance adviser, should be able to sell insurance to a customer who fulfills all mandatory requirements Business rules should be applied to all customers who attempt to buy insurance
Customers should be given the right insurance premium based on their insurance requirements
High level and Test Journeys at the UI Le
An authenticated insurance adviser, should be able to sell insurance to a customer who fulfills all mandatory requirements Business rules should be applied to all customers who attempt to buy insurance
! ! ! ! !
Tautological:!
P!needless,!redundant!repe;;on!of!an!idea! P!repe;;on!of!same!sense!in!different!words;! P!the!phrase!”a'beginner'who'has'just'started”!is!tautological!
Devs' user' Edit' UBD_CD' TB_ADR' en:ty'
Given B When D Then D
BDD at the Unit Level!
Use Builders and Fixture
h#p://en.wikipedia.org/wiki/Builder_pa#ern!
! …
Doma in Model!
Repository!
PRICING DATA
Error Handler!
Validation s!
Pricer!
JSON
Validat or!
Mandator y Validator!
Controll er!
Price Calculat or!
Cover 1 Cover 2
PRICING DATA
Most!so6ware!organiza;ons!today!suffer!from!what!I!! called!the!“Inverted!Tes+ng!Pyramid”!(…)!
h#p://blogs.agilefaqs.com/!
h#p://jamescrisp.org!
Let’s evolve…!
Slow, brittle, etc!
Shallow DoT Test Pyramid Unit BDD UI Journeys Stop TTDD!
No Tests
www.fabiopereira.me!
Thanks!
References
h#p://apcj.blogspot.com/2005_04_01_archive.html! h#p://wa;rmelon.com! h#p://jamescrisp.org! h#p://clipboarded.blogspot.com! h#p://anton.kovalyov.net/2011/02/20/whyPiPforkedPjslintPtoPjshint/! h#p://en.wikipedia.org/wiki/Builder_pa#ern! h#p://jawr.java.net/! h#p://pivotal.github.com/jasmine/! h#p://code.google.com/p/jsPtestPdriver/! h#p://blogs.agilefaqs.com/! h#p://fabiopereira.me/blog/2012/03/18/introducingPdepthPofPtestPdot/!
Images!
www.fabiopereira.me!
h#p://www.flickr.com/photos/nburrows! h#p://www.luxuryPinsider.com/uploads/news/2010/06/koreanPairPfirstPclassPawardP1.jpg! h#p://one7.files.wordpress.com/2010/06/browsers.jpg! h#p://www.luxuryPinsider.com/uploads/news/2010/06/koreanPairPfirstPclassPawardP1.jpg! h#p://www.digitalPphotographyPstudent.com/wpPcontent/uploads/2009/01/DOFPShallowPDeep.png! h#p://www.flickr.com/photos/bullgod/2604300680/! h#p://www.whatsgo#ago.com/wpPcontent/uploads/2007/12/angry_phone2.jpg! !
Quote Pricin g!
! …
BusRul e Validat or! BR1 BR2 BRN
! …
Doma in Model!
Repository!
PRICING DATA
www.fabiopereira.me!
BDD
!
Business' Broker' Renewal' Risk' Address' Insurer' '
Travel
17 ! 18 " 60 " 61 !
Quote System!
Internet
Quote System!
Authentication JSON Services!
JavaScri pt!WebServerReverseProxies
Controlle r! Repository Domain
!
Wirin g
IN MEMORY DB (HSQL)
You can test Spring Confi
High level and Test Journeys at the UI Le
An authenticated insurance adviser should be able to sell insurance to a customer who fulfills all mandatory requirements Business rules should be applied to all customers who attempt to buy insurance
T! A! U! T! O! L! O! G! I! C! A! L!
TTDD – Mocks!
Setup Mocks Call a method/function Assert that mocks were called
(Dependency Injection Code) ! !
(Mocks Setup)! !
TDD Evolution!
???????!
TODAY!
No Tests
29 year old man wants: - Car insurance - Travel insurance
Car Travel $15
Quote System! $25
62 year old man wants: - Car insurance - Travel insurance
!
Model!
Error Handler!
Validation s!
Pricer!
JSON
Validat or!
Mandator y Validator!
Controll er!
Price Calculat or!
Cover 1 Cover 2
Quote Pricin g!
! …
BusRul e Validat or! BR1 BR2 BRN
Shallow Depth of Test
Scalable TDD/BDD!
www.fabiopereira.me!
TDD Call Centre!
• Slow • Brittle • Non-deterministic • Difficult to maintain • They do not scale
Quote Pricin g!
! …
BusRul e Validat or! BR1 BR2 BRN
! …
Doma in Model!
Repository!
PRICING DATA
Age Restriction Rule!
Shallow Depth of Tes
Shallow Depth of Tes
MyTes t!
Stimulate!
Operate! Simulate!Hale Waihona Puke Baidu
Mock/Stub!
Error Handler!
Validation s!
Pricer!
JSON
Validat or!
Mandator y Validator!
Controll er!
Price Calculat or!
Cover 1 Cover 2
Car Travel (Too Old)
Quote System! $25
Can sell car insurance to people between 18 and 65. Can sell travel insurance to people between 18 and 60
Car
17 ! 18 " 60 " 61 " 65 " 66 !
Validat or!
Mandator y Validator!
Controll er!
Price Calculat or!
Cover 1 Cover 2
Quote Pricin g!
! …
BusRul e Validat or! BR1 BR2 BRN
! …
Doma in Model!
Repository!
Customers should be given the right insurance premium based on their insurance requirements
TTDD – Tautological TDD
Tauto… WHAT?!
Tautology:!from!Greek:! tauto:!the!same!! logos:!word/idea!