Mutation Testing - Backend Meetup @ STRV

Mutation Testing - Backend Meetup @ STRV

76c84b310153282b760596d4abcf8168?s=128

Ruan Martinelli

April 09, 2020
Tweet

Transcript

  1. 8.

    “What if I told you there is a codebase that

    is not yours and it passes all your tests? What if told you there are 200?” 8
  2. 9.

    Mutations are small "faults" or "bugs" inserted into your code.

    When a mutation is applied to the code, a mutant is created. Mutation testing: 1. Change your code in small ways 2. Run the test suite once for each changed version 3. Analyze results - If one or more test breaks, it’s said that the mutant was killed - If all tests passes, it’s said that the mutant survived MUTATIONS, MUTANTS & MUTATION TESTING 9
  3. 11.

    List of Mutation Testing tools: • Java - PIT •

    Ruby - Mutant • PHP - Infection • C# - VisualMutator & Stryker.NET • Python - MutPy • JavaScript - Stryker TOOLING 11
  4. 12.
  5. 13.

    KOA.JS 13 • Koa.js has 345 tests which take ~3s

    to run • 4 files were mutated, 793 mutants were created • Total execution time was 12m28s (8 cores)
  6. 14.
  7. 15.
  8. 16.
  9. 17.
  10. 18.
  11. 19.
  12. 20.
  13. 21.

    Mutation testing is resource and time-consuming • Run tests in

    the cloud periodically • Parallelism and distributed computing • Diff-based approach • AI & Machine learning • Run only on critical parts of your system GOING FURTHER 21
  14. 23.