How to write a mutation testing tool

The naive idea is to change the source code and then compile to create a mutant. But this costs a lot of compile time. A better idea:
  1. For every file
    1. Pass it to an extendable set of mutation-adders
    2. Ever mutation-adder adds its mutation wrapped in an if, which checks an environment variable, like EXPERIMENT_ID
    3. Every mutation increments the required EXPERIMENT_ID by one
  2. We compile the project
  3. It runs normally, as EXPERIMENT_ID is not set and thus every if is false, and thus disabling the mutation
  4. We now shuffle the set of experiment-ids and set it one after each other, which "causes" the mutation.
  5. This is very fast and trivial to parallelize - even on a cluster

Comments