Skip to main content

Mutation testing framework for Solidity contracts

Project description

solidity-mutate

Mutation testing framework for Solidity contracts.

Version: v0.1.0

Install

If you are using the published package from PyPI:

pip install solidity-mutate==0.1.0

If you want to work on the repository locally:

git clone <repo-url>
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 -v for summaries and -vv for full mutant logs.
  • --list-mutators
    • Print the available mutators and exit.

Repository Layout

  • src/solidity_mutate/: installable Python package
  • examples/test_contract/: Foundry sample project used by the mutator
  • pyproject.toml: package metadata and console script entrypoint

Sample Project

Run the bundled Foundry example directly:

cd examples/test_contract
forge test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solidity_mutate-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solidity_mutate-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file solidity_mutate-0.1.0.tar.gz.

File metadata

  • Download URL: solidity_mutate-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for solidity_mutate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3480f62c9e20446daa4614cfc666c65a1305ac298c547678bfd5c5c423770b82
MD5 6f951c3b01fd04b834ad5b4e35582bba
BLAKE2b-256 70036e95fe77873a0aab3240ddf78e4b339c2ada433db8dd9f756f20cbead523

See more details on using hashes here.

File details

Details for the file solidity_mutate-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for solidity_mutate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70494f460c51732accc30ab7c4dc125063aafe2f62ffc85799980bf47a746d85
MD5 50e8ddb7991bc16ffd89ac6cb8153c37
BLAKE2b-256 11eafabb5041e3f4a86611606fce268e3a1c547b23bd287c724e464178afc909

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page