English (United Kingdom)   Español(Spanish Formal International)
Mutation Testing
logo_bacterio_2

BACTERIO Mutation Test System is a testing tool for Java based on the mutation technique. Mutation is a testing technique which is based on the capability of test cases to find faults on the system under test. Mutation has been developed in the research field during the last decades, and its transference to the industrial field is being done successfully in recent years.

 

What is mutation testing?

 

Being S the system under test, mutation generates a set of mutants M={M1, M2, … Mn} from S, each one containing one or more syntactic changes, most of which will be faults. The original idea of mutation is to build a test suite that finds all the faults injected into the mutants. Each syntactic change is seeded into the mutant using a "mutation operator":

  • Table a) shows the source code of the original program and some mutants.
  • Table b) presents the results from the execution of some test cases against different program versions.

The test case corresponding to test data (1, 1) produces different outputs for the original program (whose output is correct) and for the Mutant 1: thus, this test case found the fault introduced in the mutant, and it is said that the mutant is killed. On the other hand, since all the test cases give the same output as with the original program, it is said that Mutant 4 is alive. Moreover, this mutant will never be killed by any test case since it is "functionally equivalent" to the original code. Functionally-equivalent mutants may be considered as noises in the step of result analysis, since they impede knowing the quality of the test suite: they have a fault (actually, a syntactic change on the original code) that is impossible to find by any test case.

Version

Code

Original

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

Mutant 1

int sum(int a, int b) {
return a - b;
}

Mutant 2

int sum(int a, int b) {
return a * b;
}

Mutant 3

int sum(int a, int b) {
return a / b;
}

Mutant 4

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

a) Code of some mutants

Test data (a,b)

(1, 1)

(0, 0)

(-1, 0)

(-1, -1)

Program versions

Original

2

0

-1

-2

Mutant 1

0

0

-1

0

Mutant 2

1

0

0

1

Mutant 3

1

Error

Error

1

Mutant 4

2

0

-1

-2

b) Results of some test data