Shallow               Depth of Test                 Scalable TDD/BDD	  www.fabiopereira.me	  
TDDCall Centre	            •  Slow          •  Brittle          •  Non-deterministic          •  Difficult to maintain    ...
TDD Evolution	                                  ???????	                      TODAY	             No          Tests
29 year old man wants:-  Car insurance-  Travel insurance                   Quote      Car $25      System	        Travel ...
62 year old man wants:-  Car insurance-  Travel insurance                   Quote      Car $25      System	        Travel ...
Can sell car insurance to people between 18 and 65.Can sell travel insurance to people between 18 and 60            Car   ...
InternetQuoteSystem	  
JavaScript	                   WebServer    ReverseProxies      Authentication                       JSON Services	        ...
Error  Handler	                       Validations	        Pricer	                              JSON                       ...
Error  Handler	                       Validations	        Pricer	                              JSON                       ...
Error  Handler	                       Validations	        Pricer	                              JSON                       ...
Most	  so6ware	  organiza;ons	  today	  suffer	  from	  what	  I	  	  called	  the	  “Inverted	  Tes+ng	  Pyramid”	  (…)	  ...
h#p://jamescrisp.org	  
h#p://clipboarded.blogspot.com	  
Error  Handler	                       Validations	        Pricer	                              JSON                       ...
Shallow Depth of Test	  
Shallow Depth of Test	  
MyTest	                   Stimulate	                   Operate	   Mock/Stub	     Simulate	  
Error  Handler	                       Validations	        Pricer	                              JSON                       ...
www.fabiopereira.me	  
BDD    	   Business	      Devs	   Broker	         user	  Renewal	         Edit	     Risk	       UBD_CD	  Address	       TB...
Given BWhen DThen D
BDD at the Unit Level	  
Use Builders and Fixtures	      h#p://en.wikipedia.org/wiki/Builder_pa#ern	  
BDD	            Concept   	             Tools/  Current Practices        	  
web_steps.rb	  h#p://blog.carbonfive.com/2011/11/07/modern-­‐cucumber-­‐and-­‐rails-­‐no-­‐more-­‐training-­‐wheels/	  
Simulate Http	  
Wiring
IN MEMORY DB (HSQL)
You can test Spring Config	  
High level and Test Journeys at the UI LevelAn authenticated insurance adviser	should be able to sell insurance 	to a cust...
High level and Test Journeys at the UI LevelAn authenticated insurance adviser, 	should be able to sell insurance 	to a cu...
High level and Test Journeys at the UI LevelAn authenticated insurance adviser, 	should be able to sell insurance 	to a cu...
TTDD – Tautological TDD	       Tauto…    WHAT?!
Tautology:	  from	  Greek:	  tauto:	  the	  same	  	  logos:	  word/idea	  	  	  	  	  Tautological:	  	  -­‐	  needless,	...
T	  A	  U	  T	  O	  L	  O	  G	  I	  C	  A	  L	  
TTDD – Mocks	      Setup MocksCall a method/function    Assert that mocks were called
(Dependency Injection Code)             	               	  
(Mocks Setup)	       	  
Shallow DoTLet’s evolve…	                    Test Pyramid                                    Unit BDD                     ...
www.fabiopereira.me	  
Thanks	  Referencesh#p://apcj.blogspot.com/2005_04_01_archive.html	  h#p://wa;rmelon.com	  h#p://jamescrisp.org	  h#p://cl...
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Shallow Depth of Tests Scallable BDD and TDD
Upcoming SlideShare
Loading in …5
×

Shallow Depth of Tests Scallable BDD and TDD

1,055 views

Published on

http://fabiopereira.me/blog/2012/02/05/speaking-at-qcon-beijing/
QCon Beijing presentation.
Shallow Depth of Tests - Scalable TDD/BDD
Test 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.

Published in: Economy & Finance, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,055
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Shallow Depth of Tests Scallable BDD and TDD

  1. 1. Shallow Depth of Test Scalable TDD/BDD  www.fabiopereira.me  
  2. 2. TDDCall Centre   •  Slow •  Brittle •  Non-deterministic •  Difficult to maintain •  They do not scale
  3. 3. TDD Evolution   ???????   TODAY   No Tests
  4. 4. 29 year old man wants:-  Car insurance-  Travel insurance Quote Car $25 System   Travel $15
  5. 5. 62 year old man wants:-  Car insurance-  Travel insurance Quote Car $25 System   Travel (Too Old)
  6. 6. Can sell car insurance to people between 18 and 65.Can sell travel insurance to people between 18 and 60 Car Travel 17 L 18 J 17 L 18 J Quote 60 J 60 J 61 J 61 L System   65 J 66 L
  7. 7. InternetQuoteSystem  
  8. 8. JavaScript   WebServer ReverseProxies Authentication JSON Services   Controller  Repository   Domain Model  
  9. 9. Error Handler   Validations   Pricer   JSON Quote Mandatory Controller   Validator   Pricing   Validator   Price BusRule Domain Calculator   Validator   Model      Cover1 Cover2 BR1 BR2 BRN … … Repository   PRICING DATA
  10. 10. Error Handler   Validations   Pricer   JSON Quote Mandatory Controller   Validator   Pricing   Validator   Price BusRule Domain Calculator   Validator   Model      Cover1 Cover2 BR1 BR2 BRN … … Age Restriction Repository   PRICING Rule   DATA
  11. 11. Error Handler   Validations   Pricer   JSON Quote Mandatory Controller   Validator   Pricing   Validator   Price BusRule Domain Calculator   Validator   Model      Cover1 Cover2 BR1 BR2 BRN … … Repository   PRICING DATA
  12. 12. Most  so6ware  organiza;ons  today  suffer  from  what  I    called  the  “Inverted  Tes+ng  Pyramid”  (…)   h#p://blogs.agilefaqs.com/  
  13. 13. h#p://jamescrisp.org  
  14. 14. h#p://clipboarded.blogspot.com  
  15. 15. Error Handler   Validations   Pricer   JSON Quote Mandatory Controller   Validator   Pricing   Validator   Price BusRule Domain Calculator   Validator   Model      Cover1 Cover2 BR1 BR2 BRN … … Age Restriction Repository   PRICING Rule   DATA
  16. 16. Shallow Depth of Test  
  17. 17. Shallow Depth of Test  
  18. 18. MyTest   Stimulate   Operate   Mock/Stub   Simulate  
  19. 19. Error Handler   Validations   Pricer   JSON Quote Mandatory Controller   Validator   Pricing   Validator   Price BusRule Domain Calculator   Validator   Model      Cover1 Cover2 BR1 BR2 BRN … … Repository   PRICING DATA
  20. 20. www.fabiopereira.me  
  21. 21. BDD   Business   Devs   Broker   user  Renewal   Edit   Risk   UBD_CD  Address   TB_ADR   Insurer   en:ty    
  22. 22. Given BWhen DThen D
  23. 23. BDD at the Unit Level  
  24. 24. Use Builders and Fixtures   h#p://en.wikipedia.org/wiki/Builder_pa#ern  
  25. 25. BDD   Concept   Tools/ Current Practices  
  26. 26. web_steps.rb  h#p://blog.carbonfive.com/2011/11/07/modern-­‐cucumber-­‐and-­‐rails-­‐no-­‐more-­‐training-­‐wheels/  
  27. 27. Simulate Http  
  28. 28. Wiring
  29. 29. IN MEMORY DB (HSQL)
  30. 30. You can test Spring Config  
  31. 31. High level and Test Journeys at the UI LevelAn 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
  32. 32. High level and Test Journeys at the UI LevelAn 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
  33. 33. High level and Test Journeys at the UI LevelAn 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
  34. 34. TTDD – Tautological TDD   Tauto… WHAT?!
  35. 35. 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  
  36. 36. T  A  U  T  O  L  O  G  I  C  A  L  
  37. 37. TTDD – Mocks   Setup MocksCall a method/function Assert that mocks were called
  38. 38. (Dependency Injection Code)    
  39. 39. (Mocks Setup)    
  40. 40. Shallow DoTLet’s evolve…   Test Pyramid Unit BDD UI Journeys Stop TTDD   Slow, brittle, etc   No Tests
  41. 41. www.fabiopereira.me  
  42. 42. Thanks  Referencesh#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   www.fabiopereira.me  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    

×