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

Vertical Slice testing at Agilia 2015

Vertical Slice testing at Agilia 2015

A presentation for the "Unit testing is out, Vertical Slice Testing is in" talk at Agilia 2015

Marcin Floryan

March 25, 2015

More Decks by Marcin Floryan

Other Decks in Technology


  1. March 2015 Unit Testing is out Vertical Slice Testing is

  2. I’m Marcin Floryan http://marcin.floryan.pl

  3. mfloryan @

  4. Do you test your code?

  5. Are you writing automated tests?

  6. Do you code test-first?

  7. Do you practice TDD?

  8. An experienced team of developers

  9. 18 months pair-programming TDD

  10. 635 tests 3,500 LOC

  11. None
  12. None
  13. None
  14. What is your favorite mocking framework?

  15. None
  16. None
  17. None
  18. None
  19. None
  20. None
  21. None
  22. •  HomenetFormParameterBuilderTests •  ShouldBuildUrlForHomenet •  ProcessProviderResponseHandlerTests •  ShouldExecuteCommandAgainstProviderQuote •  Should_save_events_with_consistant_hash_of_enqu

    iryId •  PanelServiceTests •  ShouldReturn404WhenTryingToRecordBrandQuoteDisp layedForEnquiryThatDoesntExist •  ShouldReturn404WhenTryingToRecordBrandQuoteDisp layedForEnquiryUsingNoContentType •  ShouldReturn400WhenTryingToRecordBrandQuoteDisp layedWhenBrandListContainsAnUnexpectedBrand •  ShouldReturn200WhenTryingToRecordNoBrandQuoteDi splayedForEnquiry
  23. Tests became brittle

  24. Test suite grew and slowed down

  25. Tests lost readability

  26. TDD is dead

  27. None
  28. VEST

  29. VErtical Slice Testing http://codebetter.com/sebastienlambla/2013/07/11/unit-testing-is-out-vertical-slice-testing-is-in/

  30. Vertical Slice single behaviour of your system

  31. Test outside-in and end to end with thin behavioural tests

  32. ports and adapters architecture

  33. External components in memory

  34. Internal components in memory

  35. Internal components in memory •  Database •  File system • 

    Network •  Message bus
  36. None
  37. Use libraries that provide accurate in-memory test adapters or write

    them yourself
  38. explicit contracts with external resources

  39. ports and adapters architecture

  40. Use language of the domain

  41. Diagnosing When sending ping Then pong is received and server

    version is announced
  42. None
  43. Missing product identifier When starting recon Then error response is

  44. Test code conventions •  Test setup in the constructor • 

    GIVEN methods setup state of the system •  Single WHEN method acts on the system •  Asserts in traditional [Test] methods – THEN •  Functionality expressed using domain language •  A base class called context abstracts implementations of tests behaviours
  45. Latest enquiries Given multiple enquiries made When retrieving latest enquiries

    Then up to ten latest enquiries are retrie ved and latest enquiries are retrieved in corre ct order
  46. None
  47. None
  48. 250 tests 2000 LOC

  49. Number of tests illustrates progress

  50. Our tests are now easier to understand by business users.

    They are easier to understand by us.
  51. I feel like we’re finally doing unit testing in the

    true sense, the way I always thought it could work.
  52. Our tests break when behaviours break, not when implementation changes

  53. The test contexts are sometimes tricky to write but once

    you get them right they are invaluable
  54. We don’t do integration testing, instead we have run- time

  55. Before I used to write new tests for every piece

    of functionality I would implement…
  56. …now I think more about changes of behaviour and modify

    or add to existing tests
  57. VETS in a nutshell • Speak language of the domain • Test

    outside-in and end-to-end • Test thin slices of system’s behaviour • Create DSL to express your tests • Use behaviourally accurate in- memory adapters (no I/O) • Compose your system of loosely coupled coherent components
  58. “TDD is dead” is dead

  59. Thank you! marcin.floryan.pl @mfloryan come and work with us