◎ “Verify that the code works” ◎ Make the contract explicit ◎ Guide the development (TDD) ◎ Prevent regression caused by ○ Other devs ○ Ourselves in the future ◎ Ensure retrocompatibility What are the goals of tests ? @xgouchet
◎ “Verify that the code works” ◎ Make the contract explicit ◎ Guide the development (TDD) ◎ Prevent regression caused by ○ Other devs ○ Ourselves in the future ◎ Ensure retrocompatibility What are the goals of tests ? @xgouchet
int check(boolean a, boolean b) { if (a && b) { return 42; } else { return 0; } } void testCheck() { assertEquals(check(true, true), 42); assertEquals(check(false, false), 0); } Mutation example ² @xgouchet
int check(boolean a, boolean b) { if (a || b) { return 42; } else { return 0; } } void testCheck() { assertEquals(check(true, true), 42); assertEquals(check(false, false), 0); } Mutation example ² @xgouchet
◎ Mutants won’t find bugs in the code, just reveal test issues ◎ Not bulletproof ◎ Not a viable metric ◎ Only simulate atomic faults ◎ Costly Keep in mind... @xgouchet
◎ Only used locally in the TDD process ◎ Automatically triggered in a pre-commit hook ◎ Not ran on CI server (yet) ◎ Coverage value is not shared with management Personnal reccomendations @xgouchet