12. "Test coverage is a useful tool for finding
untested parts of a codebase. Test
coverage is of little use as a numeric
statement of how good your tests are"
(Martin Fowler, ThoughtWorks)
17. "One sign you are testing too much is if
your tests are slowing you down. If it seems
like a simple change to code causes
excessively long changes to tests, that's a
sign that there's a problem with the tests."
(Martin Fowler, ThoughtWorks)
23. "The problem is that people optimize their
performance according to how they’re
measured. You can get 85% coverage by
looking at the coverage conditions and
picking the ones that seem easiest to
satisfy…”
(Brian Marick)
25. Efeitos de métricas como meta
• Mutirão de testes
• Testes só para aumentar
cobertura
26. Efeitos de métricas como meta
• Mutirão de testes
• Testes só para aumentar cobertura
• Testes inúteis: getters, setters,
construtores
27.
28. Meta levando a decisões ruins
• Temos que testar a funcionalidade X
29. Meta levando a decisões ruins
• Temos que testar a funcionalidade X
• Testá-la pela API é muito simples
30. Meta levando a decisões ruins
• Temos que testar a funcionalidade X
• Testá-la pela API é muito simples
• Testá-la com unit tests é muito
complexo
31. Meta levando a decisões ruins
• Temos que testar a funcionalidade X
• Testá-la pela API é muito simples
• Testá-la com unit tests é muito
complexo
E aí, como testar?
52. Conclusões
• 100% de cobertura != bons testes
• Teste as partes mais complexas da
sua aplicação
53. Conclusões
• 100% de cobertura != bons testes
• Teste as partes mais complexas da
sua aplicação
• Use testes de mutação para garantir
que seus testes são eficazes
54. Referências (parte 1)
• Cobertura de código:
• http://pt.slideshare.net/Kevlin/what-we-talk-about-when-we-talk-about-
unit-testing (Palestra Kevlin Henney)
• http://martinfowler.com/bliki/TestCoverage.html
• http://martinfowler.com/bliki/AssertionFreeTesting.html
• http://www.developertesting.com/archives/
month200705/20070504-000425.html (Conto sobre Code Coverage)
• http://www.exampler.com/testing-com/writings/coverage.pdf (Artigo do
Brian Marick sobre Code Coverage)
• Complexidade de código:
• http://blog.caelum.com.br/medindo-a-complexidade-do-seu-codigo/
• http://blog.caelum.com.br/como-medir-a-coesao-lcom/
• http://www.obomprogramador.com/2014/03/lack-of-cohesion-in-
methods-4-lcom4.html
• http://c2.com/cgi/wiki?AbcMetric