Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDD in Real World

TDD in Real World

Nowadays TDD is gaining more and more popularity, although there is still a huge number of projects and teams not practicing it. In this presentation we'll see what benefits TDD brings, when we should use it and when it is not highly needed. We'll also find out how to setup and automate the whole process within iOS project to make the most of it.

D94c9a683d3b45cfe42548cd5a1a39b0?s=128

Alexander Voronov

September 04, 2016
Tweet

Transcript

  1. @aleks_voronov TDD in Real World ALEXANDER VORONOV @aleks_voronov

  2. @aleks_voronov OUR GOAL

  3. @aleks_voronov SURVIVAL OF THE FITTEST

  4. @aleks_voronov MANUAL TESTING

  5. @aleks_voronov OH YOU THINK IT'S FASTER?

  6. @aleks_voronov OH YOU THINK IT'S FASTER?

  7. @aleks_voronov LESSONS LEARNED

  8. @aleks_voronov – Heraclitus “Everything flows”

  9. @aleks_voronov SUCCESS!

  10. @aleks_voronov OR IS IT?

  11. @aleks_voronov FEEDBACK LOOP

  12. @aleks_voronov AUTOMATED TESTING

  13. @aleks_voronov UNIT TESTS INTEGRATION TESTS ACCEPTANCE TESTS MANUAL

  14. @aleks_voronov UNIT TESTS INTEGRATION TESTS ACCEPTANCE TESTS MANUAL

  15. @aleks_voronov UNIT TESTS INTEGRATION TESTS ACCEPTANCE TESTS MANUAL

  16. @aleks_voronov UNIT TESTS INTEGRATION TESTS ACCEPTANCE TESTS MANUAL

  17. @aleks_voronov SELF-TESTING CODE

  18. @aleks_voronov TEST DRIVEN DEVELOPMENT

  19. @aleks_voronov TDD AS A PRACTICE DEVELOPMENT PRACTICE

  20. @aleks_voronov TESTS FIRST RED ‣ GREEN ‣ REFACTOR

  21. @aleks_voronov THINK FIRST THINK ‣ RED ‣ GREEN ‣ REFACTOR

  22. @aleks_voronov PROFIT✨

  23. @aleks_voronov SOUNDS LIKE WE ACHIEVE SAME WITH UNIT TESTS...

  24. @aleks_voronov UNIT TESTING VS TDD

  25. @aleks_voronov ONLY NECESSARY CODE BEST CODE IS NO CODE

  26. @aleks_voronov RED STAGE SCHOOL TRUE TEST ALWAYS REMEMBERS WHERE IT

    COMES FROM
  27. @aleks_voronov CLEANER INTERFACES

  28. @aleks_voronov CLEANER INTERFACES ‣ TESTS ARE FIRST TO USE CODE

  29. @aleks_voronov CLEANER INTERFACES ‣ TESTS ARE FIRST TO USE CODE

    ‣ PLAY IN PURE SANDBOX ENVIRONMENT
  30. @aleks_voronov CLEANER INTERFACES ‣ TESTS ARE FIRST TO USE CODE

    ‣ PLAY IN PURE SANDBOX ENVIRONMENT ‣ UNBIASED DESIGNING
  31. @aleks_voronov CLEANER INTERFACES ‣ TESTS ARE FIRST TO USE CODE

    ‣ PLAY IN PURE SANDBOX ENVIRONMENT ‣ UNBIASED DESIGNING ‣ POORLY DESIGNED CODE WITH TESTS IS STILL BETTER THAN
 POORLY DESIGNED CODE WITHOUT TESTS
  32. @aleks_voronov QUESTIONS ARISE

  33. @aleks_voronov WHAT IF I NEED CODE FIRST?

  34. @aleks_voronov SPIKE SOLUTION

  35. @aleks_voronov SPIKE SOLUTION ‣ ISOLATE

  36. @aleks_voronov SPIKE SOLUTION ‣ ISOLATE ‣ SHORTEN FEEDBACK LOOP: REPL,

    PLAYGROUND, FIDDLE
  37. @aleks_voronov SPIKE SOLUTION ‣ ISOLATE ‣ SHORTEN FEEDBACK LOOP: REPL,

    PLAYGROUND, FIDDLE ‣ SETUP SANDBOX: LIBRARIES, STUBBED RESPONSES
  38. @aleks_voronov REFACTORING WITH TDD

  39. @aleks_voronov REFACTORING IS ABOUT CODE NOT LOGIC

  40. @aleks_voronov CHANGING INTERFACE

  41. @aleks_voronov I ❤ PROTOCOLS

  42. @aleks_voronov STRIVE FOR CONFIDENCE

  43. @aleks_voronov CHANGING IMPLEMENTATION

  44. @aleks_voronov DEPENDENCIES

  45. @aleks_voronov TEST DOUBLES

  46. @aleks_voronov TEST DOUBLES ‣ DUMMIES

  47. @aleks_voronov TEST DOUBLES ‣ DUMMIES ‣ FAKES

  48. @aleks_voronov TEST DOUBLES ‣ DUMMIES ‣ FAKES ‣ STUBS

  49. @aleks_voronov TEST DOUBLES ‣ DUMMIES ‣ FAKES ‣ STUBS ‣

    SPIES
  50. @aleks_voronov TEST DOUBLES ‣ DUMMIES ‣ FAKES ‣ STUBS ‣

    SPIES ‣ MOCKS
  51. @aleks_voronov TESTING STYLES CLASSICAL & MOCKIST

  52. @aleks_voronov CLASSICAL TESTING

  53. @aleks_voronov CLASSICAL TESTING ‣ ABOUT STATE

  54. @aleks_voronov CLASSICAL TESTING ‣ ABOUT STATE ‣ CAN BREAK ENCAPSULATION

  55. @aleks_voronov CLASSICAL TESTING ‣ ABOUT STATE ‣ CAN BREAK ENCAPSULATION

    ‣ USE STUBS
  56. @aleks_voronov MOCKIST TESTING

  57. @aleks_voronov MOCKIST TESTING ‣ ABOUT BEHAVIOUR

  58. @aleks_voronov MOCKIST TESTING ‣ ABOUT BEHAVIOUR ‣ TELL, DON'T ASK

  59. @aleks_voronov MOCKIST TESTING ‣ ABOUT BEHAVIOUR ‣ TELL, DON'T ASK

    ‣ USE MOCKS
  60. @aleks_voronov DETECT BAD SMELL EARLY

  61. @aleks_voronov TDD FOR BETTER DESIGN

  62. @aleks_voronov TESTS ARE FIRST WHO LEAVE FEEDBACK

  63. @aleks_voronov TESTS HELP YOU EVOLVE

  64. @aleks_voronov FUNCTIONAL CORE IMPERATIVE SHELL

  65. @aleks_voronov INTRODUCING TDD TO YOUR TEAM

  66. @aleks_voronov INTRODUCING TDD TO YOUR TEAM ‣ JUST START WRITING

    TESTS
  67. @aleks_voronov INTRODUCING TDD TO YOUR TEAM ‣ JUST START WRITING

    TESTS ‣ TEST SIMPLEST THINGS
  68. @aleks_voronov INTRODUCING TDD TO YOUR TEAM ‣ JUST START WRITING

    TESTS ‣ TEST SIMPLEST THINGS ‣ GET USED WITH TOOLS
  69. @aleks_voronov INTRODUCING TDD TO YOUR TEAM ‣ JUST START WRITING

    TESTS ‣ TEST SIMPLEST THINGS ‣ GET USED WITH TOOLS ‣ LET OTHERS SEE WHAT YOU DO
  70. @aleks_voronov INTRODUCING TDD TO YOUR TEAM ‣ JUST START WRITING

    TESTS ‣ TEST SIMPLEST THINGS ‣ GET USED WITH TOOLS ‣ LET OTHERS SEE WHAT YOU DO ‣ INTRODUCE BOY SCOUT RULE
  71. @aleks_voronov INTRODUCING TDD TO YOUR TEAM ‣ JUST START WRITING

    TESTS ‣ TEST SIMPLEST THINGS ‣ GET USED WITH TOOLS ‣ LET OTHERS SEE WHAT YOU DO ‣ INTRODUCE BOY SCOUT RULE ‣ PAIR PROGRAMMING
  72. @aleks_voronov HOW TO START WRITING TESTS?

  73. @aleks_voronov INTRODUCING TDD TO LEGACY PROJECT

  74. @aleks_voronov INTRODUCING TDD TO LEGACY PROJECT ‣ REMEMBER BOY SCOUT

    RULE?
  75. @aleks_voronov INTRODUCING TDD TO LEGACY PROJECT ‣ REMEMBER BOY SCOUT

    RULE? ‣ START WITH CRITICAL FEATURES
  76. @aleks_voronov INTRODUCING TDD TO LEGACY PROJECT ‣ REMEMBER BOY SCOUT

    RULE? ‣ START WITH CRITICAL FEATURES ‣ FIND LOWEST POINT YOU CAN TEST
  77. @aleks_voronov INTRODUCING TDD TO LEGACY PROJECT ‣ REMEMBER BOY SCOUT

    RULE? ‣ START WITH CRITICAL FEATURES ‣ FIND LOWEST POINT YOU CAN TEST ‣ ADD TESTS, THEN REFACTOR
  78. @aleks_voronov INTRODUCING TDD TO LEGACY PROJECT ‣ REMEMBER BOY SCOUT

    RULE? ‣ START WITH CRITICAL FEATURES ‣ FIND LOWEST POINT YOU CAN TEST ‣ ADD TESTS, THEN REFACTOR ‣ STEP BY STEP
  79. @aleks_voronov INTRODUCING TDD TO LEGACY PROJECT ‣ REMEMBER BOY SCOUT

    RULE? ‣ START WITH CRITICAL FEATURES ‣ FIND LOWEST POINT YOU CAN TEST ‣ ADD TESTS, THEN REFACTOR ‣ STEP BY STEP ‣ YES, IT TAKES TIME
  80. @aleks_voronov INTEGRATIONS

  81. @aleks_voronov CONTINUOUS INTEGRATION

  82. @aleks_voronov WALKING SKELETON FIRST

  83. @aleks_voronov CI SERVICES

  84. @aleks_voronov SEPARATE JOB PER CONFIG

  85. @aleks_voronov PULL REQUESTS & CODE REVIEW

  86. @aleks_voronov MAKE IT FUN AND CLEAR

  87. @aleks_voronov DESKTOP OR MESSENGER NOTIFICATIONS

  88. @aleks_voronov MAKE IT FUN AND CLEAR

  89. @aleks_voronov CONTINUOUS DEPLOYMENT

  90. @aleks_voronov MAKE IT FUN AND CLEAR

  91. @aleks_voronov CODE COVERAGE

  92. @aleks_voronov READING LIST

  93. @aleks_voronov THANK YOU! QUESTIONS?