Can mutation testing be successfully used to improve TDD from a defect reduction perspective?开发者_运维百科
IMHO mutation testing theoretically can reduce defects not only in a TDD context, but in other contexts as well... The only problem is that is not used very often in practice. See also Is mutation testing useful in practice?
I use it, and consider it a success.
If you want to use mutation testing for Java, I highly recommend to use the new Javalanche tool by David Schuler rather than Jester and friends. Javalanche manipulates bytecode rather than sourcecode, and is thus orders of magnitudes faster.
Usefulness of unit tests is no longer discussed.
They are essential in conception of a quality application. But, how can we assess their relevance?
A code coverage indicator up to 100% doesn’t mean the code is 100% tested. This is just a view of executed code during unit tests execution.
This technique will allow you to have more confidence in your tests.
This is a two step process: first mutants generation and then bloodshed of them. WTF?
Yes, I believe it is a good complement to TDD.
Developers at Google seem to use it as an aid for code-review or pull-request inspection:
https://homes.cs.washington.edu/~rjust/publ/industrial_mutation_icst_2018.pdf
Here's a quote from the paper:
Developers have decided to redesign large chunks of code to make them testable just so a mutant could be killed, they have found bugs in complex logical expressions looking at mutants, they have decided to remove code with an equivalent mutant because they deemed it a premature optimization, they’ve claimed the mutant saved them hours of debugging and even production outages because no test cases were covering the logic under mutation properly. Mutation testing has been called one of the best improvements in the code review verification in years. While this feedback is hardly quantifiable, combined with the sheer number of thousands of developers willing to inspect surfaced mutants on their code changes makes a statement.
It could, but with a bit of effort. Please check this,
http://abeletsky.blogspot.com/2010/07/using-of-mutation-testing-in-real.html
精彩评论