Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --iterate option #354
Add --iterate option #354
Changes from all commits
d935632
9fd4656
32e58cd
ef64556
6f09dbd
39f085b
e00530d
ad73960
e225028
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Iterating on missed mutants
When you're working to improve test coverage in a tree, you might use a process like this:
Run
cargo-mutants
to find code that's untested, possibly filtering to some selected files.Think about why some mutants are missed, and then write tests that will catch them.
Run cargo-mutants again to learn whether your tests caught all the mutants, or if any remain.
Repeat until everything is caught.
You can speed up this process by using the
--iterate
option. This tells cargo-mutants to skip mutants that were either caught or unviable in a previous run, and to accumulate the results.You can run repeatedly with
--iterate
, adding tests each time, until all the missed mutants are caught (or skipped.)How it works
When
--iterate
is given, cargo-mutants readsmutants.out/caught.txt
,previously_caught.txt
, andunviable.txt
before renaming that directory tomutants.out.old
. If those files don't exist, the lists are assumed to be empty.Mutants are then tested as usual, but excluding all the mutants named in those files.
--list --iterate
also applies this exclusion and shows you which mutants will be tested.Mutants are matched based on their file name, line, column, and description, just as shown in
--list
and in those files. As a result, if you insert or move text in a source file, some mutants may be re-tested.After testing, all the previously caught, caught, and unviable are written into
previously_caught.txt
so that they'll be excluded on future runs.previously_caught.txt
is only written when--iterate
is given.Caution
--iterate
is a heuristic, and makes the assumption that any new changes you make won't reduce coverage, which might not be true. After you think you've caught all the mutants, you should run again without--iterate
to make sure.