-
Notifications
You must be signed in to change notification settings - Fork 140
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 mutation testing #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm looking forward to trying this out on our other projects. Is there a way to ignore a certain mutation if we know it's not useful information?
It might be nice to add a section the readme about how to do the mutation testing, including where to install gambit
I've added new doc with all the steps: d3e5df6 In the JSON config file (which is the input to Gambit for generating mutants), you can specify which kind of "mutation operators" you want to applied. Here is the list of all supported operators. You can also ie. limit mutation operators to the specific functions that you're interested in testing. Once mutated files are generated, currently there is no way to tell the testing script to skip some of them. But we can add that feature if it would be useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR adds integration with Certora's Gambit mutation testing framework. Gambit receives Solidity file or list of files as input, and it will generate "mutants" as output. Those are copies of original file, but each with an atomic modification of original file, ie. flipped operator, mutated 'if' condition etc. Idea is to then run the test suite against the mutant. If all tests still pass, mutant survived, that's bad - either there's faulty test or there is missing coverage. If some test(s) fail, mutant's been killed, that's good.
gambitTester
script works like this:test-mutation/config.json
How to use it:
test-mutation/config.json
with the list of solidity files to be testedyarn run test:mutation