How good are your test cases? Maybe they are good, or maybe you need to add some new ones. How to tell? You can measure things like code coverage to check if some parts of your code were not executed. Still, this does not tell you anything about the quality of your assertions and your software testing results. In the extreme case, a test suite with no assertions might still achieve 100% code coverage, although being of questionable value.
This article presents a simple and efficient engine which produces mutations of source code written in C# with helps testing it. The novelty of this engine is that it produces mutations that do not contradict with the specifications of the program. The latter are described by a set of pre- and post-conditions and invariants. The engine comprises two parts, a static analysis and syntactic verification component and a mutation generation component. Preliminary experiments showed that the proposed engine is more efficient than a simple mutations generator in terms of producing only valid mutations according to the specifications posed, thus saving time and effort during testing activities.
Mutation testing is known for being difficult and expensive, but we’re here to show you a real-world system you can build in just a few hours with a little C# code and Visual Studio.