shallow depth of tests scallable bdd and tdd
DESCRIPTION
http://fabiopereira.me/blog/2012/02/05/speaking-at-qcon-beijing/QCon Beijing presentation.Shallow Depth of Tests - Scalable TDD/BDDTest automation is prevalent in the software development community. Practices like TDD and BDD are widespread and applied almost unquestionably. However, several organisations have struggled in attempting to scale automated test suites, which very often become slow, brittle, non-deterministic, unreliable and difficult to maintain.In this talk, I will discuss some common mistakes, Tautological TDD (TTDD), for example, and also present patterns that I have successfully applied, such as Shallow Depth of Tests and Testing Pyramid. These have enabled us to achieve maintainable and scalable tests that fulfill their purpose - to help software development teams deliver faster and more confidently the features required by business people.TRANSCRIPT
![Page 1: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/1.jpg)
Shallow Depth of Test Scalable TDD/BDD
www.fabiopereira.me
![Page 2: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/2.jpg)
TDD Call Centre
• Slow • Brittle • Non-deterministic • Difficult to maintain • They do not scale
![Page 3: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/3.jpg)
No Tests
TODAY
???????
TDD Evolution
![Page 4: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/4.jpg)
Quote System
29 year old man wants: - Car insurance - Travel insurance
Car $25 Travel $15
![Page 5: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/5.jpg)
Quote System
62 year old man wants: - Car insurance - Travel insurance
Car $25 Travel (Too Old)
![Page 6: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/6.jpg)
Quote System
Can sell car insurance to people between 18 and 65. Can sell travel insurance to people between 18 and 60
Travel 17 L 18 J 60 J 61 L
Car 17 L 18 J 60 J 61 J 65 J 66 L
![Page 7: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/7.jpg)
Internet
Quote System
![Page 8: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/8.jpg)
Controller Domain Model
JavaScript
Repository
WebServer ReverseProxies Authentication
JSON Services
![Page 9: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/9.jpg)
Controller Quote Pricing Validator Mandatory
Validator
BusRule Validator
BR1 BR2 BRN …
Domain Model
Validations
Price Calculator
Cover1 Cover2 …
PRICING DATA
Pricer Error Handler
Repository
JSON
![Page 10: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/10.jpg)
Controller Quote Pricing Validator Mandatory
Validator
BusRule Validator
BR1 BR2 BRN …
Domain Model
Validations
Price Calculator
Cover1 Cover2 …
PRICING DATA
Pricer Error Handler
Repository
JSON
Age Restriction Rule
![Page 11: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/11.jpg)
Controller Quote Pricing Validator Mandatory
Validator
BusRule Validator
BR1 BR2 BRN …
Domain Model
Validations
Price Calculator
Cover1 Cover2 …
PRICING DATA
Pricer Error Handler
Repository
JSON
![Page 12: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/12.jpg)
![Page 13: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/13.jpg)
![Page 14: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/14.jpg)
![Page 15: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/15.jpg)
h#p://blogs.agilefaqs.com/
Most so6ware organiza;ons today suffer from what I called the “Inverted Tes+ng Pyramid” (…)
![Page 16: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/16.jpg)
h#p://jamescrisp.org
![Page 17: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/17.jpg)
![Page 18: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/18.jpg)
h#p://clipboarded.blogspot.com
![Page 19: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/19.jpg)
![Page 20: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/20.jpg)
![Page 21: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/21.jpg)
Controller Quote Pricing Validator Mandatory
Validator
BusRule Validator
BR1 BR2 BRN …
Domain Model
Validations
Price Calculator
Cover1 Cover2 …
PRICING DATA
Pricer Error Handler
Repository
JSON
Age Restriction Rule
![Page 22: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/22.jpg)
Shallow Depth of Test
![Page 23: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/23.jpg)
Shallow Depth of Test
![Page 24: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/24.jpg)
MyTest
Mock/Stub
Stimulate
Operate
Simulate
![Page 25: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/25.jpg)
Controller Quote Pricing Validator Mandatory
Validator
BusRule Validator
BR1 BR2 BRN …
Domain Model
Validations
Price Calculator
Cover1 Cover2 …
PRICING DATA
Pricer Error Handler
Repository
JSON
![Page 26: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/26.jpg)
www.fabiopereira.me
![Page 27: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/27.jpg)
![Page 28: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/28.jpg)
Business Devs Broker Renewal Risk
Address Insurer
user Edit
UBD_CD TB_ADR en:ty
BDD
![Page 29: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/29.jpg)
Given When Then
B D D
![Page 30: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/30.jpg)
BDD at the Unit Level
![Page 31: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/31.jpg)
Use Builders and Fixtures
h#p://en.wikipedia.org/wiki/Builder_pa#ern
![Page 32: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/32.jpg)
BDD
Concept
Tools/ Current Practices
![Page 33: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/33.jpg)
h#p://blog.carbonfive.com/2011/11/07/modern-‐cucumber-‐and-‐rails-‐no-‐more-‐training-‐wheels/
web_steps.rb
![Page 34: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/34.jpg)
Simulate Http
![Page 35: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/35.jpg)
Wiring
![Page 36: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/36.jpg)
IN MEMORY DB (HSQL)
![Page 37: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/37.jpg)
You can test Spring Config
![Page 38: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/38.jpg)
High level and Test Journeys at the UI Level
An authenticated insurance advisershould be able to sell insurance to a customer who fulfills all mandatory requirementsBusiness rules should be applied toall customers who attempt to buy insuranceCustomers should be given the right insurance premium based on their insurance requirements
![Page 39: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/39.jpg)
High level and Test Journeys at the UI Level
An authenticated insurance adviser, should be able to sell insurance to a customer who fulfills all mandatory requirementsBusiness rules should be applied toall customers who attempt to buy insuranceCustomers should be given the right insurance premium based on their insurance requirements
![Page 40: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/40.jpg)
High level and Test Journeys at the UI Level
An authenticated insurance adviser, should be able to sell insurance to a customer who fulfills all mandatory requirementsBusiness rules should be applied toall customers who attempt to buy insuranceCustomers should be given the right insurance premium based on their insurance requirements
![Page 41: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/41.jpg)
![Page 42: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/42.jpg)
TTDD – Tautological TDD
Tauto… WHAT?!
![Page 43: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/43.jpg)
Tautology: from Greek: tauto: the same logos: word/idea Tautological: -‐ needless, redundant repe;;on of an idea -‐ repe;;on of same sense in different words; -‐ the phrase ”a beginner who has just started” is tautological
![Page 44: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/44.jpg)
T A U T O L O G I C A L
![Page 45: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/45.jpg)
![Page 46: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/46.jpg)
TTDD – Mocks
Setup Mocks
Call a method/function
Assert that mocks were called
![Page 47: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/47.jpg)
![Page 48: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/48.jpg)
(Dependency Injection Code)
![Page 49: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/49.jpg)
(Mocks Setup)
![Page 50: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/50.jpg)
No Tests
Slow, brittle, etc
Shallow DoT Test Pyramid Unit BDD UI Journeys Stop TTDD
Let’s evolve…
![Page 51: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/51.jpg)
www.fabiopereira.me
![Page 52: Shallow Depth of Tests Scallable BDD and TDD](https://reader038.vdocuments.us/reader038/viewer/2022102815/5561f0c6d8b42a9d068b575a/html5/thumbnails/52.jpg)
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/why-‐i-‐forked-‐jslint-‐to-‐jshint/ 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/js-‐test-‐driver/ h#p://blogs.agilefaqs.com/ h#p://fabiopereira.me/blog/2012/03/18/introducing-‐depth-‐of-‐test-‐dot/
Images h#p://www.flickr.com/photos/nburrows h#p://www.luxury-‐insider.com/uploads/news/2010/06/korean-‐air-‐first-‐class-‐award-‐1.jpg h#p://one7.files.wordpress.com/2010/06/browsers.jpg h#p://www.luxury-‐insider.com/uploads/news/2010/06/korean-‐air-‐first-‐class-‐award-‐1.jpg h#p://www.digital-‐photography-‐student.com/wp-‐content/uploads/2009/01/DOF-‐Shallow-‐Deep.png h#p://www.flickr.com/photos/bullgod/2604300680/ h#p://www.whatsgo#ago.com/wp-‐content/uploads/2007/12/angry_phone2.jpg
Thanks
www.fabiopereira.me