Mutation testing framework for Solidity contracts
Project description
solidity-mutate
Mutation testing framework for Solidity contracts.
Version: v0.1.1
Install
If you are using the published package from PyPI:
pip install solidity-mutate==0.1.1
If you want to work on the repository locally:
git clone https://github.com/sidarth16/solidity-mutate.git
cd solidity-mutate
pip install -e .
Run
Run the tool from the repo root against the bundled Foundry example:
solidity-mutate examples/test_contract --safe
You can also run it as a module:
python3 -m solidity_mutate examples/test_contract --safe
To inspect the available mutators:
solidity-mutate --list-mutators
CLI Arguments
target- Path to the Solidity project root.
- Default:
..
--file- Mutate only one Solidity file relative to the project root.
- Example:
contracts/token.sol
--test-cmd- Command used to run tests for each mutant.
- Default:
forge test
--mutators- Comma-separated mutators to run.
- Default:
all
--timeout- Timeout in seconds for each test command run.
- Default:
30
--safe- Run a preflight test before mutation and a postflight test after mutation.
-v- Increase verbosity.
- Use
-vfor summaries and-vvfor full mutant logs.
--list-mutators- Print the available mutators and exit.
Repository Layout
src/solidity_mutate/: installable Python packageexamples/test_contract/: Foundry sample project used by the mutatorpyproject.toml: package metadata and console script entrypoint
Sample Project
Run the bundled Foundry example directly:
cd examples/test_contract
forge test
Sample Results
The bundled example project currently reaches:
100%line coverage100%statement coverage55.56%mutation score
Coverage Report
Mutation Report
-vv Sample Output
Full Output
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solidity_mutate-0.1.1.tar.gz.
File metadata
- Download URL: solidity_mutate-0.1.1.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
616c87e3fc0d8a2dfadf5f3dc95c06a6add3acdd4dd0dd4750986fc3117572f5
|
|
| MD5 |
1e226dd92b4067bef0972155b520e7d9
|
|
| BLAKE2b-256 |
4a76b99356763074b18be38b70fb917b09009f32e43b9eb46bc7d7b07bd89bdc
|
File details
Details for the file solidity_mutate-0.1.1-py3-none-any.whl.
File metadata
- Download URL: solidity_mutate-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
913d0d173d4d735270368a475b69089c8ba4c2ccd1aabcfd912394aadbabb817
|
|
| MD5 |
d6702244809f6bf81b73f73b00fc8e3b
|
|
| BLAKE2b-256 |
8b3686ca2d56f5a06a1ac445188f96423ab5f95ce52d89bcefe129abc3b80853
|