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:
- For every file
- Pass it to an extendable set of mutation-adders
- Ever mutation-adder adds its mutation wrapped in an if, which checks an environment variable, like EXPERIMENT_ID
- Every mutation increments the required EXPERIMENT_ID by one
- We compile the project
- It runs normally, as EXPERIMENT_ID is not set and thus every if is false, and thus disabling the mutation
- We now shuffle the set of experiment-ids and set it one after each other, which "causes" the mutation.
- This is very fast and trivial to parallelize - even on a cluster
Comments
Post a Comment