Successfully reported this slideshow.

Mutation Testing - Voxxed Days Cluj-Napoca 2017

0

Share

Loading in …3
×
1 of 116
1 of 116

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Mutation Testing - Voxxed Days Cluj-Napoca 2017

  1. 1. Mutation Testing ł
  2. 2. $327.6 million
  3. 3. really?
  4. 4. return a + b;
  5. 5. return a + b;
  6. 6. public class Calculator { public int sum(int a, int b) { return a + b; } }
  7. 7. @Test public void force100PercentCoverage() { calculator.sum(0, 0); }
  8. 8. return a + b;
  9. 9. return a - b;
  10. 10.
  11. 11. ● ●
  12. 12. ● ● ●
  13. 13. ● ● ● ●
  14. 14. return a - b;
  15. 15. public class Calculator { public int sum(int a, int b) { return a + b; } } @Test public void force100PercentCoverage() { calculator.sum(0, 0); }
  16. 16. > MathMutator >> Generated 1 Killed 0 (0%) > KILLED 0 SURVIVED 1 > TIMED_OUT 0 NON_VIABLE 0 > MEMORY_ERROR 0 NOT_STARTED 0 > STARTED 0 RUN_ERROR 0 > NO_COVERAGE 0
  17. 17. @Test public void Should_ReturnSum_When_SummingTwoValues() { // given int a = 1; int b = 2; // when int result = calculator.sum(a, b); // then assertThat(result).isEqualTo(3); }
  18. 18. > MathMutator >> Generated 1 Killed 1 (100%) > KILLED 1 SURVIVED 0 > TIMED_OUT 0 NON_VIABLE 0 > MEMORY_ERROR 0 NOT_STARTED 0 > STARTED 0 RUN_ERROR 0 > NO_COVERAGE 0
  19. 19. ● ●
  20. 20. if (a >= 100) { throw new IllegalArgumentException(); } if (a < 100) { fooBar(); }
  21. 21. if (a >= 100) { throw new IllegalArgumentException(); } if (a < 100) { fooBar(); }
  22. 22. return a + b;
  23. 23. return a + b;
  24. 24. return a + b; return a - b return 0
  25. 25. return a + b; return a - b return 0
  26. 26. :)
  27. 27. // given
  28. 28. // given // when
  29. 29. // given // when
  30. 30. Jenkins
  31. 31. Thank you ł

×