Skip to content

jalvarez/mutation_testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mutation testing

This repository contains the code used in the PyConES 2023 talk "X-Men: How a bunch of mutants can help you to improve your tests?".

It is adaptation of the original code kata Using Mutation Testing to Weed Out Fake Unit Tests using the package mutmut as mutation tester.

Requirements

The following tools are required to run the repository code:

### Python 3.10

Install python 3.10 with pypenv, and configure to use

pyenv install 3.10
pyenv local 3.10
pyenv versions

Poetry

Install poetry in runtime python system

pip3 install poetry

PoeThePoet

Install poethepoet to run the scripts into the project using poetry

poetry self add 'poethepoet[poetry_plugin]'

Configure poetry

poetry env use 3.10
poetry install

Workflow

We added some commands that can help you to resolve the kata:

Init

To initialise mutmut, run the mutation tester and get the first results:

poetry poe init

Launch tests

To run the tests and get the coverage report:

poetry poe pytest

Show and apply a mutant

To show the mutant and apply this mutant to our code, and get the test:

poetry poe select [mutant identifier]

Solving

The repository contains the branch a solution, which contains a sequence of steps to eliminate all the mutants.

However, this solution does not raise all the test smells suggested by the original kata. For example, it didn't catch the bug in the test_leading_trailing_spaces_removed_from_employee_name test.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages