Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What mutation-testing frameworks exist for C/C++?

Mutation testing has been out there for a while now, and it seems there are at least one or two commercial mutation testing frameworks for C/C++. Have you used them? What are your experiences? Are there any open source alternatives?

like image 293
Jason Orendorff Avatar asked Jan 17 '11 17:01

Jason Orendorff


People also ask

What type of testing is mutation testing?

Mutation testing, also known as code mutation testing, is a form of white box testing in which testers change specific components of an application's source code to ensure a software test suite will be able to detect the changes.

How we can conduct mutation testing?

Mutation testing is done by selecting a set of mutation operators and then applying them to the source program one at a time for each applicable piece of the source code. The result of applying one mutation operator to the program is called a mutant.

Is mutation testing structural testing?

Mutation testing is a structural testing method, i.e. we use the structure of the code to guide the test process.

What are mutations in programming?

Mutation is a common side-effect in programming. To mutate a variable once it has been defined means to alter its value. For example, (define x 3) x. will evaluate to 3.


2 Answers

A brief search resulted in:

  • PlexTest: http://www.itregister.com.au/products/plextest_detail.htm
  • Insure++: http://www.parasoft.com/jsp/products/insure.jsp;jsessionid=baacpvbaDywLID?itemId=63
  • MILU (may be only for C): http://www.dcs.kcl.ac.uk/pg/jiayue/milu/

With that said, you need to realize that mutation testing isn't particularly useful (at least from some stuff I've previously read). It's an interesting tool when faced with hard (metaphorically speaking) asserts and for making sure that data requirements are heeded to (when dealing with if and only if situations).

In my opinion, there are much more established ways of analyzing the robustness of code.

like image 149
David Titarenco Avatar answered Oct 21 '22 04:10

David Titarenco


Notice that Parasoft's tool only generate equivalent mutations. That echoes the problem described on Wikipedia article about Mutation Testing - it is hard to distinguish between equivalent and non-equivalent mutations so they decided to stick with equivalent.

I tried another interesting tool that can automatically discover invariants in instrumented C and C++ code - it is called "Daikon". Essentially it is doing same thing as tool that generates equivalent mutations, but instead of identifying problematic code it gives you a set of invariants such as "A == B + 1". I think invariants are more useful because when you look at discovered invariant it gives you assurance that your code is correct if invariant make sense, and then you can convert invariants into asserts and that gives you more confidence when you change code.

like image 34
Alexei Polkhanov Avatar answered Oct 21 '22 02:10

Alexei Polkhanov