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

How to write good tests?

How to write good tests?

Small talk that I gave to @debitoor guys about practices of writing tests.

Alexander Beletsky

April 12, 2013
Tweet

More Decks by Alexander Beletsky

Other Decks in Programming

Transcript

  1. How to
    write good tests?

    View Slide

  2. Honestly,
    I don’t know

    View Slide

  3. But, there are
    properties
    of good tests…

    View Slide

  4. … are written
    before code

    View Slide

  5. … are running
    very fast

    View Slide

  6. … are helping
    to find regressions

    View Slide

  7. Writing unit tests
    is not about
    code verification

    View Slide

  8. … it’s about code
    quality and design

    View Slide

  9. Think different
    Think TDD

    View Slide

  10. Could TDD be
    applied to
    everything?

    View Slide

  11. In short, yes
    code, requirements, ui

    View Slide

  12. Should TDD be
    applied to
    everything?

    View Slide

  13. Probably, no
    simple tasks, prototypes

    View Slide

  14. There are few
    techniques of
    writing tests

    View Slide

  15. Classic school
    Kent Beck, 90’s
    Inside-Out design
    Focusing on logic (algorithms)

    View Slide

  16. London school
    Jason Gorman, 00’s
    Outside-In design
    Focusing on collaboration
    Mocks

    View Slide

  17. What about
    integration tests?

    View Slide

  18. They are slow,
    hard to write, hard
    to setup… but

    View Slide

  19. … they usually
    caught most nasty
    bugs.

    View Slide

  20. View Slide

  21. Maintaining test
    driven cycle

    View Slide

  22. View Slide

  23. Acceptance test (PO communication)
    API (integration) tests
    Utils (units) tests

    View Slide

  24. Thanks,
    @alexbeletsky

    View Slide