Tests de mutabilité
A.K.A. Mutation testing
C’est quoi un mutant?
Pas ça
C’est quoi des tests de mutabilité?
Exemple #1
def light?(switch) switch ? :on : :off end
Original
def light?(switch) true ? :on : :off end
Mutant
Test
expect(light?(true)).to be(:on)
Les tests passent encore...
expect(light?(true)).to be(:on) expect(light?(false)).to be(:off)
Le mutant est mort
Mutation testing pour tous
Ruby
Mutant - https://github.com/mbj/mutant
Python
MutPy - https://pypi.python.org/pypi/MutPy/0.4.0
Java
PIT - http://pitest.org/
PHP
Mutagenesis - https://github.com/padraic/mutagenesis
By Jean-François Chaput