8000 GitHub - gaetbout/starknet-mutation-testing
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gaetbout/starknet-mutation-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starknet Mutation Testing

Note: This project is still in an experimental stage. Please ensure you always back up your code.

What is Mutation Testing?

Mutation testing is a software testing technique used to evaluate the quality and effectiveness of test cases. It involves making small, deliberate changes to the program's source code, known as "mutants," and then running the test cases to determine if they can detect these changes. If a test case fails when a mutant is introduced, it means the test case is effective at catching that type of error. If the test case passes despite the mutant, it indicates a potential weakness in the test suite.

Requirements

  • This tool only works with Scarb.
  • The folder where the contracts are located must be called src.
  • The tests (if using snforge) must be in a folder called tests.
  • If your tests are in the same file as the code, whenever the test attribute #[cfg(test)] is encountered, the rest of the file is ignored.
  • If you are using snforge to test your project, ensure you have this snippet in your Scarb.toml:
[scripts]
test = "snforge test"

Limitation

At the moment only one line mutation are supported. For example if you have an assert(...) spread on multiple lines, it won't be modified.

Mutation supported

  • == <=> !=
  • > => >=, <
  • >= => ==, >
  • < => <=, >
  • <= => ==, <
  • assert() => Commented
  • && <=> ||
  • is_zero => is_non_zero

Usage

Clone this repository and run:

cargo run -- --path PATH

This will run all mutation tests.

To check a specific file only, use:

cargo run -- --path PATH --file PATH_TO_FILE

If you stop the execution early, you can clean the generated files by running:

cargo run -- --clean

For more information about all available options, run:

cargo run -- --help

Interesting Links

License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0