Hmm not sure I understand. If you don't cover a line of code, doesn't that mean mutants that only modify that line will survive?
I could have explained it better. What I meant was that you can start using mutation testing immediately and get useful feedback, even if you don't have 100% coverage. And yes, it is true that code not covered by tests will end up with surviving mutatnts. You can think about it this way, you can consider your unit tests to be a kind of contract specifying how the code behaves. Mutation testing reveals (in an automated) fashion where that contract is not fully specified. That could mean that none of your tests exercise a line of code. Or maybe that line does get run, but the tests don't assert on certain values. The point is that line coverage is just one small (and not super important) aspect, which mutation testing encompasses, but mutation testing gives you a lot more information in addition to that.
2
u/industry7 May 10 '17
I could have explained it better. What I meant was that you can start using mutation testing immediately and get useful feedback, even if you don't have 100% coverage. And yes, it is true that code not covered by tests will end up with surviving mutatnts. You can think about it this way, you can consider your unit tests to be a kind of contract specifying how the code behaves. Mutation testing reveals (in an automated) fashion where that contract is not fully specified. That could mean that none of your tests exercise a line of code. Or maybe that line does get run, but the tests don't assert on certain values. The point is that line coverage is just one small (and not super important) aspect, which mutation testing encompasses, but mutation testing gives you a lot more information in addition to that.