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.
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
Install poetry in runtime python system
pip3 install poetry
Install poethepoet to run the scripts into the project using poetry
poetry self add 'poethepoet[poetry_plugin]'
poetry env use 3.10
poetry install
We added some commands that can help you to resolve the kata:
To initialise mutmut, run the mutation tester and get the first results:
poetry poe init
To run the tests and get the coverage report:
poetry poe pytest
To show the mutant and apply this mutant to our code, and get the test:
poetry poe select [mutant identifier]
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.