Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Maria Clara Santana, Picter

80 views

Published on

“Who watches the watchmen": Testando nossos testes - Maria Clara Santana, Picter

[JS EXPERIENCE 2018] - 5 de julho de 2018
São Paulo/SP

Published in: Technology
  • Be the first to comment

[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Maria Clara Santana, Picter

  1. 1. “WHO WATCHES THE WATCHMEN” Testing our tests Maria C. Santana JS Experience ‘18
  2. 2. Maria Clara • Front-end Developer @ Picter • Live Coding Instructor @ Udacity • Likes dogs and sparkling water
  3. 3. Types of software errors • Construction errors; • Specification errors; • Design errors; • Requirements errors; Toward a theory of test data selection, Softech Inc.
  4. 4. BLACK-BOX TESTING
  5. 5. Input Output
  6. 6. •Pro: Allows to check the functionality of a program without worrying with the structure behind it; •Con: Does not offer insights about the tested program’s structure;
  7. 7. High code coverage !== Effective Test Suite
  8. 8. Source: https://gph.is/1jE2Wzg
  9. 9. Take it with a grain of salt.
  10. 10. “Quis custodiet ipsos custodes?” Satires, 2a.c.
  11. 11. WHITE-BOX TESTING
  12. 12. Input Output
  13. 13. •Pro: More thorough tests; •Con: Can be complex and require a lot of work due to implementation changes;
  14. 14. MUTATION TESTING
  15. 15. CONCEPT
  16. 16. #1 STEP Test data Original code
  17. 17. •If it fails, then the original program is wrong; •If it passes, then we should proceed with creating mutants;
  18. 18. #2 STEP Test data N modified versions of the original code
  19. 19. •#1: given the test data, the modified versions have different outputs from the original one; •#2: some (or all of them) versions have the same output of the original one;
  20. 20. MUTATORS TYPES
  21. 21. Not this kind, though…
  22. 22. AAR (array for array replacement)
  23. 23. ABS (absolute value insertion)
  24. 24. AOR (arithmetic operator replacement)
  25. 25. UOI (unary operation insertion)
  26. 26. Many others… • Array constant replacement; • Logical connector replacement; • Relational operator replacement; • Constant replacement; • Return statement replacement; • Statement deletion; • …
  27. 27. EXAMPLE
  28. 28. Original program
  29. 29. Test suite
  30. 30. Mutant #1 - Conditional operator replacement
  31. 31. Mutant #1 - Test suite results Mutant was killed! 🎉
  32. 32. Mutant #2 - Conditional operator replacement
  33. 33. Mutant #2 - Test suite results Mutant has survived… ☹
  34. 34. EQUIVALENT MUTANTS
  35. 35. Mutant #3 - Return statement replacement
  36. 36. Mutant #3 - Test suite results Mutant was killed! 🎉
  37. 37. mutation score = mutants killed / total of mutants; -> 100%
  38. 38. TOOLS
  39. 39. https://stryker-mutator.io/
  40. 40. Trade-offs •Open-source; •Active maintenance and improvements; •Supports most of the mainstream runners (karma, jasmine, jest, …); •Does not support React;
  41. 41. Other languages… • Python: https://github.com/mutpy/mutpy; • Ruby: https://github.com/mbj/mutant; • Java: https://github.com/hcoles/pitest;
  42. 42. PROS
  43. 43. •Application safety; •Evaluation of edge cases; •Better test design;
  44. 44. CONS
  45. 45. •High computational costs; •Filtering equivalent mutants is still a non-optimal task;
  46. 46. Q&A
  47. 47. THANKS! olarclara.github.io

×