Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mutation testing tool for Python 2.7

While writing another unittest in Python and after learning about multiple testing methods, I got curious how many mutants would be killed if I performed mutation testing on my code.

The problem is that I use Python 2.7 and the only tool I found is MutPy and it's for Python 3.x.

Does anyone know about any (stable and supported) tool for mutation testing for Python 2.7?

like image 736
BreadHunter Avatar asked Sep 20 '14 23:09

BreadHunter


People also ask

What is mutation testing Python?

Mutpy is a Mutation testing tool in Python that generated mutants and computes a mutation score. It supports standard unittest module, generates YAML/HTML reports and has colorful output. It applies mutation on AST level.

What is mutation Python?

Mutating methods are ones that change the object after the method has been used. Non-mutating methods do not change the object after the method has been used. The count and index methods are both non-mutating. Count returns the number of occurrences of the argument given but does not change the original string or list.

What is mutation testing in software engineering?

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. Changes introduced to the software are intended to cause errors in the program.


2 Answers

Mutmut works for python 2.7 as well as python 3.6. It's also super easy to get started with and supports all test runners that can return an operating system exit code.

EDIT: Mutmut has now dropped python 2.7 support. But older versions still work on python 2.7 of course!

like image 120
boxed Avatar answered Sep 21 '22 13:09

boxed


This is a library for Python2: https://github.com/sk-/elcap

like image 24
Federico Avatar answered Sep 19 '22 13:09

Federico