and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent...

316
Making Mutants Work For You or how I learned to stop worrying and love equivalent mutants

Transcript of and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent...

Page 1: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Blank space needed here . . . just because

Making MutantsWork For

You

or how I learned to stop worryingand love equivalent mutants

Page 2: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Blank space needed here . . . just because

Hello

Page 3: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Blank space needed here . . . just because

Hello

?

Page 4: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Questions

Page 5: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

How do I safely refactor mytests?

Page 6: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

How do I know if I can trust atest suite I inherited?

Page 7: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

How do I ensure the tests I’mwriting are effective?

Page 8: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

How do I know if my team iswriting effective tests?

Page 9: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Really just one question

Page 10: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

How do I assess the quality of atest suite?

Page 11: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Common developer answers

Page 12: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Don’t worry - it’ll be fine

Page 13: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

That’s QA’s problem

Page 14: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I’m a Ninja Rockstar, I know mytests are good

Page 15: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Better answers

Page 16: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I do TDD, I know my tests aregood.

• Are you sure?• What about the tests you didn’t write?• How do you test drive changes to your tests?• Do you write tests for your tests?• Do you write tests for the tests for your tests??

Page 17: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I do TDD, I know my tests aregood.

• Are you sure?

• What about the tests you didn’t write?• How do you test drive changes to your tests?• Do you write tests for your tests?• Do you write tests for the tests for your tests??

Page 18: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I do TDD, I know my tests aregood.

• Are you sure?• What about the tests you didn’t write?

• How do you test drive changes to your tests?• Do you write tests for your tests?• Do you write tests for the tests for your tests??

Page 19: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I do TDD, I know my tests aregood.

• Are you sure?• What about the tests you didn’t write?• How do you test drive changes to your tests?

• Do you write tests for your tests?• Do you write tests for the tests for your tests??

Page 20: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I do TDD, I know my tests aregood.

• Are you sure?• What about the tests you didn’t write?• How do you test drive changes to your tests?• Do you write tests for your tests?

• Do you write tests for the tests for your tests??

Page 21: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I do TDD, I know my tests aregood.

• Are you sure?• What about the tests you didn’t write?• How do you test drive changes to your tests?• Do you write tests for your tests?• Do you write tests for the tests for your tests??

Page 22: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Peer review

Good but …

• Catches problems inconsistently• Labour intensive• Slow form of feedback

Page 23: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Peer reviewGood but …

• Catches problems inconsistently• Labour intensive• Slow form of feedback

Page 24: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Peer reviewGood but …

• Catches problems inconsistently

• Labour intensive• Slow form of feedback

Page 25: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Peer reviewGood but …

• Catches problems inconsistently• Labour intensive

• Slow form of feedback

Page 26: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Peer reviewGood but …

• Catches problems inconsistently• Labour intensive• Slow form of feedback

Page 27: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Code coverage

Most Commonly one of :-

• Line• Branch• Statement

Page 28: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Code coverage

Most Commonly one of :-

• Line• Branch• Statement

Page 29: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Code coverage

Most Commonly one of :-

• Line

• Branch• Statement

Page 30: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Code coverage

Most Commonly one of :-

• Line• Branch

• Statement

Page 31: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Code coverage

Most Commonly one of :-

• Line• Branch• Statement

Page 32: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But there are many others

• Data• Path• Modified condition / decision• more …

Page 33: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But there are many others

• Data

• Path• Modified condition / decision• more …

Page 34: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But there are many others

• Data• Path

• Modified condition / decision• more …

Page 35: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But there are many others

• Data• Path• Modified condition / decision

• more …

Page 36: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But there are many others

• Data• Path• Modified condition / decision• more …

Page 37: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

None of these of these coveragemeasures tell you which parts ofyour code have been tested

Page 38: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

What code coverage does tell you

Page 39: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

What code coverage does tell you

Page 40: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

What code coverage does tell you

Page 41: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

What code coverage does tell you

Page 42: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Executing code and testing codeare not the same thing

Page 43: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 44: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But most tests are written ingood faith

Page 45: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 46: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Code coverage tells you onlywhat has not been tested

Page 47: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Lets fix that the bad faith test

Page 48: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 49: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

All ok now?

Page 50: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 51: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So our answers aren’t that great

Page 52: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Back in 1971 Richard Liptonprovided a good answer to ourquestions

decades before most people were writing unit tests.

Page 53: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Back in 1971 Richard Liptonprovided a good answer to ourquestions

decades before most people were writing unit tests.

Page 54: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

He wrote a paper entitled “Faultdiagnosis of computer programs”

Page 55: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Here’s Lipton’s idea

Page 56: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

If you want to know if a testsuite has properly checked somecode - introduce a bug

Page 57: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Then see if your test suite canfind it

Page 58: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Here’s a bug

public void count(int i) {if ( i > 10 ) {

count++;}

}

Page 59: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Here’s a bug

public void count(int i) {if ( i > 10 ) { // changed >= to >

count++;}

}

Page 60: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Our tests still pass

Page 61: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Our test suite is deficient

Page 62: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

A test case is missing

@Testpublic void shouldCountIntegersOfExactlyTen() {

testee.count(10);assertEquals(1,testee.currentCount());

}

Page 63: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >• >= to =• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();• 0 to 1• etc etc

Page 64: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >• >= to =• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();• 0 to 1• etc etc

Page 65: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=

• >= to >• >= to =• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();• 0 to 1• etc etc

Page 66: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >

• >= to =• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();• 0 to 1• etc etc

Page 67: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >• >= to =

• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();• 0 to 1• etc etc

Page 68: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >• >= to =• foo.aMethod(); to //foo.aMethod();

• foo.aMethod(); to foo.anotherMethod();• 0 to 1• etc etc

Page 69: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >• >= to =• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();

• 0 to 1• etc etc

Page 70: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >• >= to =• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();• 0 to 1

• etc etc

Page 71: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some terminology

A change such as >= to > is a mutation operator

Lots are possible

• >= to <=• >= to >• >= to =• foo.aMethod(); to //foo.aMethod();• foo.aMethod(); to foo.anotherMethod();• 0 to 1• etc etc

Page 72: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Applying a mutation operator tosome code creates a mutant

We can create lots of mutants and we can do it automatically

Page 73: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Applying a mutation operator tosome code creates a mutantWe can create lots of mutants and we can do it automatically

Page 74: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

If a mutant does not cause a testto fail it survived

Page 75: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

If a mutant does cause a test tofail it was killed

So killing is good

Page 76: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

If a mutant does cause a test tofail it was killedSo killing is good

Page 77: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But what about this?

class Foo {int min;public void bar(int i) {

if (i < min) {min = i;

}System.out.println("" + min);

}}

Page 78: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

We can mutate it

class Foo {int min;public void bar(int i) {

if (i <= min) { // changed < to <=min = i;

}System.out.println("" + min);

}}

But it still behaves the same

Page 79: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

We can mutate it

class Foo {int min;public void bar(int i) {

if (i <= min) { // changed < to <=min = i;

}System.out.println("" + min);

}}

But it still behaves the same

Page 80: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It is not possible to write a testthat kills this mutant

Page 81: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The mutant is said to beequivalent

Page 82: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Equivalent mutants areconsidered to be a problem

They need a human to examine them

We’ll talk more about them later

Page 83: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Equivalent mutants areconsidered to be a problem

They need a human to examine them

We’ll talk more about them later

Page 84: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Equivalent mutants areconsidered to be a problem

They need a human to examine them

We’ll talk more about them later

Page 85: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing highlights codethat definitely is tested

Page 86: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It gives a very high degree ofconfidence in a test suite

Page 87: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It can sometimes find bugs

If your program was almost correct, a mutant version might becorrect

Page 88: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It can sometimes find bugs

If your program was almost correct, a mutant version might becorrect

Page 89: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It effectively tests your tests

So you can refactor your tests without fear

Page 90: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It effectively tests your tests

So you can refactor your tests without fear

Page 91: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So what happened to this idea?

Page 92: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

1971 - Lipton’s paper

Page 93: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 94: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 95: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 96: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 97: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 98: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 99: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 100: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 101: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 102: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Just 9 short years later

The first automated tool!

Page 103: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Just 9 short years later

The first automated tool!

Page 104: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 105: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 106: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 107: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 108: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Lots of research papers

Page 109: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

If your test suite can findartificial bugs, can it find realones?

Page 110: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The competent programmerhypothesis

“Programmers are generally competent enough to produce code thatis at least almost right”

Page 111: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The competent programmerhypothesis

“Programmers are generally competent enough to produce code thatis at least almost right”

Page 112: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The competent programmerhypothesis

“Programmers are generally competent enough to produce code thatis at least almost right”

Page 113: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing introducessmall changes to the code

So the mutants look like bugs from our “competent” programmer

Page 114: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing introducessmall changes to the code

So the mutants look like bugs from our “competent” programmer

Page 115: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some real bugs do look like this

But others are more complex

Page 116: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some real bugs do look like this

But others are more complex

Page 117: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The coupling effect

“Tests that can distinguish a program differing from a correct one byonly simple errors can also implicitly distinguish more complexerrors”

Page 118: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The coupling effect

“Tests that can distinguish a program differing from a correct one byonly simple errors can also implicitly distinguish more complexerrors”

Page 119: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

There is strong empiricalsupport

“The major conclusion from this investigation is that by explicitlytesting for simple faults, we are also implicitly testing for morecomplicated faults” 1

1A. Offutt. 1989. The coupling effect: fact or fiction. In Proceedings of the ACMSIGSOFT ’89 third symposium on Software testing, analysis, and verification

Page 120: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

There is strong empiricalsupport

“The major conclusion from this investigation is that by explicitlytesting for simple faults, we are also implicitly testing for morecomplicated faults” 1

1A. Offutt. 1989. The coupling effect: fact or fiction. In Proceedings of the ACMSIGSOFT ’89 third symposium on Software testing, analysis, and verification

Page 121: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But this is just a probabilisticstatement

You will find counter examples

Page 122: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But this is just a probabilisticstatementYou will find counter examples

Page 123: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So if your tests find mutants,they will probably find real bugs

Page 124: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 125: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

A few more academic tools

Page 126: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 127: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 128: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Jester

Page 129: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

“Why just think your tests are good when you can know for sure?Sometimes Jester tells me my tests are airtight, but sometimes thechanges it finds come as a bolt out of the blue. Highlyrecommended.”

Kent Beck

Page 130: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

No-body used it

Page 131: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Lots more research papers

Page 132: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

2018

In daily use all over the world

Folk keep talking about it at conferences

Page 133: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

2018In daily use all over the world

Folk keep talking about it at conferences

Page 134: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

2018In daily use all over the world

Folk keep talking about it at conferences

Page 135: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

High profile projects

Page 136: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 137: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 138: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But mainly “normal” code

• Recruitment websites• Tractor sales• Insurance• Banking• Biotech• Media

Page 139: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But mainly “normal” code

• Recruitment websites• Tractor sales• Insurance• Banking• Biotech• Media

Page 140: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So what happened?

Page 141: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

40 years of research suggestedthere were two fundamentalproblems

Page 142: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

1. Too slow

Page 143: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

2. Equivalent mutants

Page 144: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Too slow

• Need to compile the code thousands of times• Need to run the test suite thousands of times

Page 145: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Too slow

• Need to compile the code thousands of times

• Need to run the test suite thousands of times

Page 146: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Too slow

• Need to compile the code thousands of times• Need to run the test suite thousands of times

Page 147: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Joda Time

A small library for dealing with dates and times.

• 68k lines of code• 70k lines of test code• Takes about 10 seconds to compile• Takes about 16 seconds to run the unit tests

Page 148: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Joda TimeA small library for dealing with dates and times.

• 68k lines of code• 70k lines of test code• Takes about 10 seconds to compile• Takes about 16 seconds to run the unit tests

Page 149: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Joda TimeA small library for dealing with dates and times.

• 68k lines of code

• 70k lines of test code• Takes about 10 seconds to compile• Takes about 16 seconds to run the unit tests

Page 150: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Joda TimeA small library for dealing with dates and times.

• 68k lines of code• 70k lines of test code

• Takes about 10 seconds to compile• Takes about 16 seconds to run the unit tests

Page 151: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Joda TimeA small library for dealing with dates and times.

• 68k lines of code• 70k lines of test code• Takes about 10 seconds to compile

• Takes about 16 seconds to run the unit tests

Page 152: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Joda TimeA small library for dealing with dates and times.

• 68k lines of code• 70k lines of test code• Takes about 10 seconds to compile• Takes about 16 seconds to run the unit tests

Page 153: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Lets say we have 10k mutants

Page 154: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

(100000) + (160000)compile test

Page 155: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

260000 seconds

Page 156: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

72 hours

Page 157: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

3 days!

Page 158: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So in theory mutation testing iswildly impractical

Page 159: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I didn’t understand this

So I tried to build a mutation testing tool

Page 160: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I didn’t understand thisSo I tried to build a mutation testing tool

Page 161: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Blank space needed here . . . just because

Page 162: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Live demo time

Page 163: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 164: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

A tiny assertion library fromGoogle

Page 165: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

About 3000 lines of code

Page 166: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Takes about 3 seconds to compile

Page 167: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Takes about 7 seconds to run thetests

Page 168: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Has about 90% line coverage

Page 169: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

If we generated a modest 700mutants

Page 170: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Would take about 2 hours

Page 171: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Lets try it

Page 172: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

mvn -Ppitest test

Page 173: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So why didn’t that take 2 hours?

Page 174: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Lots of reasons

Page 175: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It runs in parallel

Mutation testing is embarrassingly parallelisable

Most machines these days have at least 2 cores

2 cores = half the time

Page 176: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It runs in parallel

Mutation testing is embarrassingly parallelisable

Most machines these days have at least 2 cores

2 cores = half the time

Page 177: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It runs in parallel

Mutation testing is embarrassingly parallelisable

Most machines these days have at least 2 cores

2 cores = half the time

Page 178: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It runs in parallel

Mutation testing is embarrassingly parallelisable

Most machines these days have at least 2 cores

2 cores = half the time

Page 179: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

No compilation cycles

Mutants created by bytecode manipulation

Can generate hundreds of thousands in <1 second

Page 180: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

No compilation cycles

Mutants created by bytecode manipulation

Can generate hundreds of thousands in <1 second

Page 181: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

No compilation cycles

Mutants created by bytecode manipulation

Can generate hundreds of thousands in <1 second

Page 182: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Test prioritisation

Run the cheap tests first, the expensive ones later

stop when one fails

Page 183: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Test prioritisation

Run the cheap tests first, the expensive ones later

stop when one fails

Page 184: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Test prioritisation

Run the cheap tests first, the expensive ones later

stop when one fails

Page 185: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Test selectionPitest gathers per test line coverage data

Tests are only run against a mutant if they exercise the mutated lineof code

Page 186: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Test selectionPitest gathers per test line coverage data

Tests are only run against a mutant if they exercise the mutated lineof code

Page 187: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

This makes a huge difference

Page 188: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 189: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

shouldNotCountIntegersBelowTen

Page 190: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

shouldCountIntegersAboveTen

shouldNotCountIntegersBelowTen

Page 191: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

shouldCountIntegersAboveTen

shouldNotCountIntegersBelowTen

shouldStartWithEmptyCount

Page 192: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

>

• We will only run 2 tests for the mutation on line 5• The mutation will survive as we’re missing an effective test case

Page 193: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

>

• We will only run 2 tests for the mutation on line 5

• The mutation will survive as we’re missing an effective test case

Page 194: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

>

• We will only run 2 tests for the mutation on line 5• The mutation will survive as we’re missing an effective test case

Page 195: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

//

• We will run only 1 test for the mutation on line 6• The mutation will be killed

Page 196: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

//

• We will run only 1 test for the mutation on line 6

• The mutation will be killed

Page 197: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

//

• We will run only 1 test for the mutation on line 6• The mutation will be killed

Page 198: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

1

• We will run no tests for the mutation on line 11• The mutation will be instantly marked as survived• This is makes a huge different

Page 199: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

1

• We will run no tests for the mutation on line 11

• The mutation will be instantly marked as survived• This is makes a huge different

Page 200: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

1

• We will run no tests for the mutation on line 11• The mutation will be instantly marked as survived

• This is makes a huge different

Page 201: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

1

• We will run no tests for the mutation on line 11• The mutation will be instantly marked as survived• This is makes a huge different

Page 202: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

To analyse JodaTime

• 8 minutes on cheap dual core laptop• 3 minutes on a quad core

That’s over 1000 times faster than early systems

Page 203: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

To analyse JodaTime

• 8 minutes on cheap dual core laptop

• 3 minutes on a quad core

That’s over 1000 times faster than early systems

Page 204: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

To analyse JodaTime

• 8 minutes on cheap dual core laptop• 3 minutes on a quad core

That’s over 1000 times faster than early systems

Page 205: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

To analyse JodaTime

• 8 minutes on cheap dual core laptop• 3 minutes on a quad core

That’s over 1000 times faster than early systems

Page 206: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

To analyse JodaTime

• 8 minutes on cheap dual core laptop• 3 minutes on a quad core

That’s over 1000 times faster than early systems

Page 207: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But what about big codebases?

Page 208: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Turns out size doesn’t matter

Page 209: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

To understand why we need totalk about what mutation testingis useful for

and how to use it

Page 210: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

To understand why we need totalk about what mutation testingis useful forand how to use it

Page 211: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

A lot of the research assumed ithad to work like this

Page 212: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Write abunch of code

and tests

Pass it to a QAteam to mutation test

Page 213: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Many developers assume youuse it like this

Page 214: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Write abunch of code

and tests

Page 215: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Write abunch of code

and tests

Mutation test overnight on a server

Page 216: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Write abunch of code

and tests

Brag about the size of your metric

Mutation test overnight on a server

Page 217: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But I only ever use it like this

Page 218: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Write afailingtest

Make thetest pass

Refactor Mutation test affected code

Page 219: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Or sometimes

Page 220: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Spike outcode

Write tests

fix the messMutation test affected code

Page 221: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I’d be too scared to do thiswithout mutation testing

Page 222: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I only have to analyse a smallslice of the code

Page 223: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It doesn’t matter how big thecodebase is

Page 224: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The slice is always small

Page 225: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Pitest integrates with versioncontrol

But often I just target it at a certain package

Page 226: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Pitest integrates with versioncontrolBut often I just target it at a certain package

Page 227: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing is a powerfultool

Page 228: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I don’t use it as a metric

Page 229: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I don’t care what the codecoverage of a project is

Page 230: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I don’t care what the mutationscore for a project is

Page 231: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

I care about the feedback it givesme

Page 232: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

And the actions it prompts me totake

Page 233: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Equivalent mutants

Page 234: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Research suggests it takes 15minutes to assess if a mutant isequivalent

Page 235: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But this assumes that the personassessing hasn’t just written thecode

It’s much less effort as part of a development feedback loop

Page 236: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But this assumes that the personassessing hasn’t just written thecodeIt’s much less effort as part of a development feedback loop

Page 237: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Equivalent mutants are aproblem for a test strengthmetric

Page 238: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But they can provide usefulinformation for a developer

They’re a side benefit

Page 239: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But they can provide usefulinformation for a developer

They’re a side benefit

Page 240: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

If a mutant survives I do one ofthree things

Page 241: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Add a test

Or sometimes fix a buggy test

Page 242: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Add a testOr sometimes fix a buggy test

Page 243: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Delete some code

Page 244: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Re-express some code

Or sometimes change its behaviour

Page 245: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Re-express some code

Or sometimes change its behaviour

Page 246: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some examples

Page 247: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

public void someLogic(int i) {if (i <= 100) {

throw new IllegalArgumentException();}

if (i > 100) {doSomething();

}}

Page 248: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

public void someLogic(int i) {if (i <= 100) {

throw new IllegalArgumentException();}

if (i >= 100) { // mutated > to >=doSomething();

}}

i can never be 100 at this point

So the mutant is equivalent

Page 249: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

public void someLogic(int i) {if (i <= 100) {

throw new IllegalArgumentException();}

if (i >= 100) { // mutated > to >=doSomething();

}}

i can never be 100 at this point

So the mutant is equivalent

Page 250: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

public void someLogic(int i) {if (i <= 100) {

throw new IllegalArgumentException();}

if (i >= 100) { // mutated > to >=doSomething();

}}

i can never be 100 at this point

So the mutant is equivalent

Page 251: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

The code is redundant

Page 252: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

public void someLogic(int i) {if (i <= 100) {

throw new IllegalArgumentException();}

doSomething();}

Functionally equivalent but there’s less of it

Page 253: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

public void someLogic(int i) {if (i <= 100) {

throw new IllegalArgumentException();}

doSomething();}

Functionally equivalent but there’s less of it

Page 254: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing is really good athighlighting redundant code

Page 255: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

class Foo {int min;public void bar(int i) {

if (i < min) {min = i;

}System.out.println("" + min);

}}

Page 256: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

class Foo {int min;public void bar(int i) {

if (i <= min) { // mutate < to <=min = i;

}System.out.println("" + min);

}}

Page 257: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

A classic logically equivalentmutant

We can make it go away

Page 258: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

A classic logically equivalentmutantWe can make it go away

Page 259: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

class Foo {int min;public void bar(int i) {

min = Math.min(i, min);System.out.println("" + min);

}}

The code now expresses its intent

Page 260: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

class Foo {int min;public void bar(int i) {

min = Math.min(i, min);System.out.println("" + min);

}}

The code now expresses its intent

Page 261: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So sometimes equivalent mutantsprompt us to improve the code

Page 262: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing creates pressureto

• Reduce the amount of code• Reduce the amount of duplication

Page 263: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing creates pressureto

• Reduce the amount of code

• Reduce the amount of duplication

Page 264: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing creates pressureto

• Reduce the amount of code• Reduce the amount of duplication

Page 265: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Many equivalent mutants affectonly performance

(performance is not a concern of unit testing)

Page 266: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Many equivalent mutants affectonly performance

(performance is not a concern of unit testing)

Page 267: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Is it a premature optimisation?

• Yes - delete the code• No - ignore the mutant

Page 268: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Is it a premature optimisation?

• Yes - delete the code

• No - ignore the mutant

Page 269: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Is it a premature optimisation?

• Yes - delete the code• No - ignore the mutant

Page 270: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

What did pitest find in GoogleTruth?

Page 271: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Some classic test errors

Page 272: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

PrimitiveIntSubjectArray

Page 273: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

PrimitiveIntSubjectArray

Page 274: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutant is covered by at least onetest

Page 275: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutant is covered by at least onetest

Page 276: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

An equivalent mutation

Page 277: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

PrimitiveDoubleArraySubject

Page 278: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

PrimitiveDoubleArraySubject

Page 279: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

PrimitiveDoubleArraySubject

Page 280: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Performance isn’t unit testable

Optimisation makes sense in this case

Page 281: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Performance isn’t unit testableOptimisation makes sense in this case

Page 282: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But wouldn’t it be better if themessage was?

“%s unexpectedly equal to %s (in fact they are the same)”

Page 283: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

But wouldn’t it be better if themessage was?

“%s unexpectedly equal to %s (in fact they are the same)”

Page 284: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

So perhaps the equivalentmutation highlighted a betterbehaviour

Page 285: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

What if we think the behaviouris perfect the way it is?

Page 286: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 287: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here
Page 288: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

In many code bases you willencounter no equivalent mutants

Page 289: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Seems to depend on the domainand code style

Page 290: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

When not to mutation test

Page 291: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

1. When your tests are really bad

Page 292: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing relies on testsbeing deterministic

• Same result when run a million times• Same result when run in a different order• Same result when run in parallel

Page 293: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing relies on testsbeing deterministic

• Same result when run a million times

• Same result when run in a different order• Same result when run in parallel

Page 294: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing relies on testsbeing deterministic

• Same result when run a million times• Same result when run in a different order

• Same result when run in parallel

Page 295: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Mutation testing relies on testsbeing deterministic

• Same result when run a million times• Same result when run in a different order• Same result when run in parallel

Page 296: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Everyone thinks their tests aredeterministic

But many bugs reported against pitest are due to bad tests

And bad code with singletons and mutable global state

Page 297: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Everyone thinks their tests aredeterministicBut many bugs reported against pitest are due to bad tests

And bad code with singletons and mutable global state

Page 298: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Everyone thinks their tests aredeterministicBut many bugs reported against pitest are due to bad tests

And bad code with singletons and mutable global state

Page 299: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Pitest needs unit tests

• Code runs in same jvm as tests• Fast enough to run many times

Page 300: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Pitest needs unit tests

• Code runs in same jvm as tests

• Fast enough to run many times

Page 301: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Pitest needs unit tests

• Code runs in same jvm as tests• Fast enough to run many times

Page 302: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

2. When your code does scarythings

if (!safetyFlag) {launchMissiles();

}

Page 303: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

2. When your code does scarythings

if (!safetyFlag) {launchMissiles();

}

Page 304: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Conclusions

Mutation testing is a powerfultechnique

Page 305: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It finds missing test cases

Page 306: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It finds buggy tests

Page 307: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It provides a safety net whilerefactoring your tests

Page 308: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It highlights redundant code

Page 309: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

It can highlight code smells

Page 310: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Run it as you develop

Not some time later

Page 311: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Run it as you develop

Not some time later

Page 312: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Remember it’s a tool

Not a number you need to make go up

Or a stick to beat people with

Page 313: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Remember it’s a toolNot a number you need to make go up

Or a stick to beat people with

Page 314: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Remember it’s a toolNot a number you need to make go up

Or a stick to beat people with

Page 315: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

Other languages

• Ruby - Mutant• PHP - Humbug (now Infection)• Java - Pitest (could also try Major)• Kotlin - Pitest (with caveats)• Python - Cosmic Ray• LLVM (C, C++, Swift) - Mull• Javascript - Stryker• C# - Fettle

Page 316: and love equivalent mutants - STAMP€¦ · and love or how I learned to stop equivalent mutantsworrying. Blank space needed here . . . just because Hello. Blank space needed here

@0hjc

http://pitest.orgturns out

it's me that guards the guards