gotocph thejayfields thejayfields
play

#gotocph @thejayfields @thejayfields JUnit version 4.11 ......... - PowerPoint PPT Presentation

#gotocph @thejayfields @thejayfields JUnit version 4.11 ......... @thejayfields JUnit version 4.11 .......................................................E.E.. @thejayfields JUnit version 4.11 .E.E.. There were 2 failures: 1)


  1. #gotocph @thejayfields

  2. @thejayfields JUnit version 4.11 .........

  3. @thejayfields JUnit version 4.11 .......................................................E.E..

  4. @thejayfields JUnit version 4.11 .E.E.. There were 2 failures: 1) statement(CustomerTest) org.junit.ComparisonFailure: expected:<...or John Godfather 4[ ]9.0 Amount owed is 9...> but was:<...or John Godfather 4[ ]9.0 Amount owed is 9...> 2) htmlStatement(CustomerTest) org.junit.ComparisonFailure: expected:<...</h1> <p>Godfather 4[ ]9.0</p> <p>Amount ow...> but was:<...</h1> <p>Godfather 4[ ]9.0</p> <p>Amount ow...> FAILURES!!! Tests run: 4, Failures: 2

  5. @thejayfields JUnit version 4.11 .E.E.. There were 2 failures: 1) statement(CustomerTest) org.junit.ComparisonFailure: expected:<...or John Godfather 4[ ]9.0 Amount owed is 9...> but was:<...or John Godfather 4[ ]9.0 Amount owed is 9...> 2) htmlStatement(CustomerTest) org.junit.ComparisonFailure: expected:<...</h1> <p>Godfather 4[ ]9.0</p> <p>Amount ow...> but was:<...</h1> <p>Godfather 4[ ]9.0</p> <p>Amount ow...> FAILURES!!! Tests run: 4, Failures: 2

  6. @thejayfields

  7. @thejayfields

  8. @thejayfields

  9. @thejayfields

  10. @thejayfields

  11. @thejayfields

  12. @thejayfields

  13. @thejayfields

  14. @thejayfields

  15. @thejayfields

  16. @thejayfields

  17. @thejayfields

  18. @thejayfields

  19. @thejayfields

  20. @thejayfields

  21. @thejayfields

  22. @thejayfields

  23. @thejayfields

  24. @thejayfields

  25. @thejayfields

  26. @thejayfields

  27. 1. statement()

  28. 2. customer[]

  29. 3. Customer Assignment

  30. 4. Digest setup

  31. 5. Object mother

  32. 6. OBJECT Mother customer variations

  33. 7. expected string building

  34. 8. rentalInfo()

  35. 9. rentalinfo implemtation

  36. 10. find and digest expstatement()

  37. @thejayfields why?

  38. @thejayfields we write tests we don’t need with time we don’t have to satisfy people we don’t like.

  39. @thejayfields To create a tiny universe where the software exists to do one thing and do it well. -- @delitescere

  40. @thejayfields To create a tiny universe where the software exists to do one thing and do it well. -- @delitescere

  41. @thejayfields motivators? enable refactoring, immediate feedback, and breaking a problem up into smaller pieces

  42. @thejayfields motivators? enable refactoring, immediate feedback, and breaking a problem up into smaller pieces

  43. @thejayfields motivators? enable refactoring, immediate feedback, and breaking a problem up into smaller pieces

  44. @thejayfields motivators? enable refactoring, immediate feedback, and breaking a problem up into smaller pieces

  45. @thejayfields motivators? enable refactoring, immediate feedback, and breaking a problem up into smaller pieces

  46. @thejayfields motivators? enable refactoring, immediate feedback, and breaking a problem up into smaller pieces

  47. @thejayfields DRY

  48. @thejayfields Suite / Fixture / Test

  49. @thejayfields Suite / Fixture / Test

  50. Testing unrelated customers

  51. Creating unrelated customers

  52. overextracting

  53. relevant data only

  54. one: replace loop with individual tests

  55. @thejayfields It’s only after we’ve duplicated everything that we’re free to dry anything

  56. @thejayfields two: expect literals

  57. @thejayfields

  58. @thejayfields

  59. @thejayfields three: inline setup

  60. @thejayfields

  61. @thejayfields

  62. @thejayfields Motivators

  63. @thejayfields validate the system feedback prevent regression

  64. @thejayfields code coverage

  65. @thejayfields enable refactoring

  66. @thejayfields enable refactoring

  67. @thejayfields document the system

  68. @thejayfields manager told you to

  69. @thejayfields tdd break up a problem improved design

  70. @thejayfields customer acceptance

  71. @thejayfields Any fool can write a test that helps them today. Good programmers write tests that help the entire team in the future.

  72. what can we do?

  73. This is your career and it’s ending one test suite run at a time

  74. @thejayfields a simple rule 1. never cross boundaries 2. the Class Under Test should be the only concrete class found in a test

  75. @thejayfields two simple rules 1. never cross boundaries 2. the Class Under Test should be the only concrete class found in a test

  76. @thejayfields

  77. @thejayfields

  78. @thejayfields

  79. @thejayfields

  80. @thejayfields

  81. Confidence

  82. isolation

  83. integration

  84. @thejayfields

  85. @thejayfields how else can I improve the test suite?

  86. @thejayfields

  87. @thejayfields

  88. self destruction

  89. Our tests are failing us

  90. Poor SoluTion or Poor Solution

  91. Or?

Recommend


More recommend