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

100% Test Covɘrage

100% Test Covɘrage

Serge Matveenko

May 14, 2017
Tweet

More Decks by Serge Matveenko

Other Decks in Programming

Transcript

  1. Myths • Full coverage doesn’t defend logic errors • Full

    coverage is for Unit Tests • Full coverage is for TDD
  2. Myths • Full coverage doesn’t defend logic errors • Full

    coverage is for Unit Tests • Full coverage is for TDD • Full coverage leads to very long test runs
  3. Myths • Full coverage doesn’t defend logic errors • Full

    coverage is for Unit Tests • Full coverage is for TDD • Full coverage leads to very long test runs • Full coverage is good but I have no time for that
  4. First, count it properly • Linters, static checkers, code analysis

    — cover everything • Unit tests — cover everything
  5. First, count it properly • Linters, static checkers, code analysis

    — cover everything • Unit tests — cover everything • Integration tests ◦ Delegate API/contract testing to Unit Tests, ensure API specs are implemented ◦ Delegate interoperability testing to Functional Tests, ensure API do their job
  6. First, count it properly • Linters, static checkers, code analysis

    — cover everything • Unit tests — cover everything • Integration tests ◦ Delegate API/contract testing to Unit Tests, ensure API specs are implemented ◦ Delegate interoperability testing to Functional Tests, ensure API do their job • Functional tests — cover everything again
  7. Full coverage is for Unit Tests • True if you

    like to carry orphaned code for years
  8. • True • But not exclusively • Full coverage doesn’t

    depend on strategie Full coverage is for TDD
  9. • True • But not exclusively • Full coverage doesn’t

    depend on strategie • Full coverage applies for any strategie independently Full coverage is for TDD
  10. Full coverage leads to very long test runs • True

    when you have a lot to test • Automate Smoke Testing on development branches
  11. Full coverage leads to very long test runs • True

    when you have a lot to test • Automate Smoke Testing on development branches • “Namespaces are one honking great idea -- let's do more of those!”
  12. Full coverage is good but I have no time for

    that • True if you like dig a hole for yourself
  13. Full coverage is good but I have no time for

    that • True if you like dig a hole for yourself • Make yourself get used to it • You will learn to do it faster • You will like it • You won’t see you life without it☺
  14. To TDD or not to TDD? • TDD is good

    • TDD is useless • It doesn’t matter
  15. Full Coverage Reality • Have full coverage on different test

    strategies ◦ Static ◦ Unit ◦ Functional • Know your tools ◦ Smoke ◦ Bisect ◦ Mocks ◦ Fixtures ◦ Log Levels • Full Coverage means 100% ◦ 99% is the same is 1%