https://github.com/boxed/mutation-testing-workshop
https://github.com/boxed/mutation-testing-workshop
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/boxed/mutation-testing-workshop
- Owner: boxed
- License: bsd-3-clause
- Created: 2019-12-02T12:10:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-21T14:54:33.000Z (about 6 years ago)
- Last Synced: 2025-10-04T14:00:41.442Z (9 months ago)
- Language: Shell
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mutation testing workshop
## Setup
```bash
curl https://raw.githubusercontent.com/boxed/mutation-testing-workshop/master/start.sh | bash
cd scientist
source venv/bin/activate
```
## Run tests
```bash
python -m hammett
```
# Run coverage report
```bash
python -m pytest --cov scientist
```
## Run mutation testing
```bash
mutmut run
```
Now write tests in `tests/test_scientist.py` and rerun mutmut until you have no surviving mutants!
Commands:
- `mutmut show`: see the list of mutants
- `mutmut show 4`: show mutant 4
- `mutmut show all`: see all the mutant diffs
- `mutmut apply 4`: apply the mutant 4 to disk
- `python -m pytest`: run tests
Tips:
- It can be useful to look at a few mutants at a time, especially if they are on the same line
- Mutation testing can be played in two ways:
- Look at the diff, write a test that passes, do `mutmut run` to see if you wrote the test properly
- Apply the mutant on disk, write a test that fails, revert the mutant, check that the test succeeds. You want to do `mutmut run` after too.