Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add a mutation score threshold so that we can still pass without kill… #1052

Merged
merged 3 commits into from
Jul 15, 2024
Merged

Conversation

mpownby
Copy link
Contributor

@mpownby mpownby commented Jul 4, 2024

Add a mutation score threshold so that we can still pass without killing every single mutant.

Motivation:
I want to use mull in my CI/CD pipeline to make sure incoming pull requests meet a minimum testing standard.

Currently, mull can be configured to pass (return exit code 0) if a) all mutants are killed or b) all surviving mutants are ignored. This is accomplished via the "--allow-surviving" command line option.

I'd like a more granular option. I might like to have (nearly) all mutations enabled, but killing every single mutant may not be worth it to me, especially if they are inside code that isn't critical like formatting log messages or rare catch blocks. I'd prefer to pass/fail based on a mutation score threshold.

Hence this pull request.

@AlexDenisov
Copy link
Member

Hi @mpownby, thank for the PR, this is a great idea and a great feature!

You'd need to update some test cases which are failing, and add a new test case covering this specific feature. You can put the test case somewhere here tests-lit/tests, feel free to simply copy an existing test and modify as needed.

mpownby added 2 commits July 9, 2024 23:04
removed extra logging because it breaks existing tests
Added integration test for mutation score threshold feature (mutation score should be 50%, we set our threshold to 49% and expect the test runner to still return success)
@mpownby
Copy link
Contributor Author

mpownby commented Jul 10, 2024

Hi @mpownby, thank for the PR, this is a great idea and a great feature!

You'd need to update some test cases which are failing, and add a new test case covering this specific feature. You can put the test case somewhere here tests-lit/tests, feel free to simply copy an existing test and modify as needed.

Ok, I think I finally got it. It was a real conundrum figuring out how to run the lit tests locally but I finally figured it out. I added an integration test that achieves a mutation score of 50% with a desired threshold of 49% so the runner is verified to still return success.

@AlexDenisov AlexDenisov merged commit 38f76c1 into mull-project:main Jul 15, 2024
12 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants