### Mutation Testing - Voxxed Days Bucharest 10.03.2017

1. Mutation Testing ł
2. \$327.6 million
3. really?
4. return a + b;
5. return a + b;
6. public class Calculator { public int sum(int a, int b) { return a + b; } }
7. @Test public void force100PercentCoverage() { calculator.sum(0, 0); }
8. return a + b;
9. return a - b;
10. ● ●
11. ● ● ●
12. ● ● ● ●
13. return a - b;
14. public class Calculator { public int sum(int a, int b) { return a + b; } } @Test public void force100PercentCoverage() { calculator.sum(0, 0); }
15. > 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
16. @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); }
17. > 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
18. ● ●
19. if (a >= 100) { throw new IllegalArgumentException(); } if (a < 100) { fooBar(); }
20. if (a >= 100) { throw new IllegalArgumentException(); } if (a < 100) { fooBar(); }
21. return a + b;
22. return a + b;
23. return a + b; return a - b return 0
24. return a + b; return a - b return 0
25. :)
26. // given
27. // given // when
28. // given // when
29. Jenkins
30. Thank you ł