Mutation testing

641 visualizaciones

Publicado el

Mutation testing is a process to verify the correctness of our tests. It adds a new metric, "mutation coverage", that complements the line coverage to improve our software.

Publicado en: Software
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Mutation testing

  1. 1. Mutation testing Raúl Ávila
  2. 2. I want you to increase the test coverage of our legacy systems from 0% to more than 50%…no matter how! OK!
  3. 3. Test Coverage = 100%
  4. 4. Is there any other (automatic) way to measure the quality of our tests? Mutation Testing!
  5. 5. Mutation testing: process 1. Modify production code • Modifications are called mutations 2. After each mutation -> Run test suite 3. If the suite passes -> Mutation has survived 4. If the suite fails -> Mutation killed! New metric: mutation coverage
  6. 6. Mutation testing in Java Integration with Maven
  7. 7. Example 1
  8. 8. Example 1: missing assertions
  9. 9. Example 2
  10. 10. Example 2
  11. 11. Example 2: insufficient test cases
  12. 12. Example 2: insufficient test cases
  13. 13. Examples 3
  14. 14. Examples 3
  15. 15. Examples 3: verify interactions
  16. 16. Thank you https://github.com/raulavila/pit-example

×