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.

Mutation Testing - Voxxed Days Bucharest 10.03.2017

252 views

Published on

Talk I gave at the Voxxed Days Bucharest 2017 conference.

Published in: Technology
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1lite.top/NvxhYX ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Mutation Testing - Voxxed Days Bucharest 10.03.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 ł

×