mutation testing - voxxed days bucharest 10.03.2017

116
Mutation Testing ł

Upload: rafal-leszko

Post on 20-Mar-2017

83 views

Category:

Technology


1 download

TRANSCRIPT

Mutation Testingł

$327.6 million

really?

return a + b;

return a + b;

public class Calculator { public int sum(int a, int b) { return a + b; }}

@Testpublic void force100PercentCoverage() { calculator.sum(0, 0);}

return a + b;

return a - b;

return a - b;

public class Calculator { public int sum(int a, int b) { return a + b; }}@Testpublic void force100PercentCoverage() { calculator.sum(0, 0);}

> 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

@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);}

> 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

if (a >= 100) { throw new IllegalArgumentException();}

if (a < 100) { fooBar();}

if (a >= 100) { throw new IllegalArgumentException();}

if (a < 100) { fooBar();}

return a + b;

return a + b;

return a + b;

return a - b

return 0

return a + b;

return a - b

return 0

:)

// given

// given

// when

// given

// when

Jenkins

Thank youł