Mutation Testing with Selene
To verify the quality of the test suite in this repository, we can use Selene, a mutation testing tool for Go.
1. Install Selene
If you don't have Selene installed, you can install it directly via go install:
go install github.com/danicat/selene@latest
Note: Ensure your $GOPATH/bin is in your system PATH.
2. Prepare the environment
Clone the testquery repository and navigate to its root:
git clone https://github.com/danicat/testquery
cd testquery
3. Run Mutation Testing
Run Selene on the source files. Selene will automatically run the existing tests to generate a coverage profile and will only mutate code that is currently covered by tests.
Run on all core logic files:
Or run on specific files (e.g., query logic):
4. Interpreting the Results
Selene will output the status of each mutation:
killed: A mutation was introduced, and your tests failed. This is good; it means your tests caught the logic change.
survived: A mutation was introduced, but your tests still passed. This indicates a gap in your test suite where a logic change is not being asserted.
The final Score represents the percentage of mutations that your test suite successfully caught.
Mutation Testing with Selene
To verify the quality of the test suite in this repository, we can use Selene, a mutation testing tool for Go.
1. Install Selene
If you don't have Selene installed, you can install it directly via
go install:Note: Ensure your
$GOPATH/binis in your systemPATH.2. Prepare the environment
Clone the
testqueryrepository and navigate to its root:git clone https://github.com/danicat/testquery cd testquery3. Run Mutation Testing
Run Selene on the source files. Selene will automatically run the existing tests to generate a coverage profile and will only mutate code that is currently covered by tests.
Run on all core logic files:
selene run *.goOr run on specific files (e.g., query logic):
4. Interpreting the Results
Selene will output the status of each mutation:
killed: A mutation was introduced, and your tests failed. This is good; it means your tests caught the logic change.survived: A mutation was introduced, but your tests still passed. This indicates a gap in your test suite where a logic change is not being asserted.The final Score represents the percentage of mutations that your test suite successfully caught.