mutation testing

16
Mutation testing Raúl Ávila

Upload: raul-avila

Post on 16-Aug-2015

136 views

Category:

Software


0 download

TRANSCRIPT

Mutation testing

Raúl Ávila

I want you to increase the

test coverage of our legacy systems from 0% to more

than 50%…no matter how!

OK!

Test Coverage = 100%

Is there any other (automatic) way to measure the quality of

our tests?

Mutation Testing!

Mutation testing: process

1. Modify production code

• Modifications are called mutations

2. After each mutation -> Run test suite

3. If the suite passes -> Mutation has survived

4. If the suite fails -> Mutation killed!

New metric: mutation coverage

Mutation testing in Java

Integration with Maven

Example 1

Example 1: missing assertions

Example 2

Example 2

Example 2: insufficient test cases

Example 2: insufficient test cases

Examples 3

Examples 3

Examples 3: verify interactions

Thank you

https://github.com/raulavila/pit-example