Crates.io | mutant-kraken |
lib.rs | mutant-kraken |
version | 0.1.5 |
source | src |
created_at | 2024-04-11 18:00:52.127437 |
updated_at | 2024-07-09 00:37:42.094393 |
description | A mutation testing tool for Kotlin |
homepage | |
repository | https://github.com/JosueMolinaMorales/mutant-kraken |
max_upload_size | |
id | 1205159 |
size | 368,076 |
A kotlin mutation testing tool built in Rust.
#################################################################################################################################
/$$ /$$ /$$ /$$ /$$ /$$ /$$
| $$$ /$$$ | $$ | $$ | $$ /$$/ | $$
| $$$$ /$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ | $$ /$$/ /$$$$$$ /$$$$$$ | $$ /$$ /$$$$$$ /$$$$$$$
| $$ $$/$$ $$| $$ | $$|_ $$_/ |____ $$| $$__ $$|_ $$_/ | $$$$$/ /$$__ $$|____ $$| $$ /$$/ /$$__ $$| $$__ $$
| $$ $$$| $$| $$ | $$ | $$ /$$$$$$$| $$ \ $$ | $$ | $$ $$ | $$ \__/ /$$$$$$$| $$$$$$/ | $$$$$$$$| $$ \ $$
| $$\ $ | $$| $$ | $$ | $$ /$$ /$$__ $$| $$ | $$ | $$ /$$ | $$\ $$ | $$ /$$__ $$| $$_ $$ | $$_____/| $$ | $$
| $$ \/ | $$| $$$$$$/ | $$$$/| $$$$$$$| $$ | $$ | $$$$/ | $$ \ $$| $$ | $$$$$$$| $$ \ $$| $$$$$$$| $$ | $$
|__/ |__/ \______/ \___/ \_______/|__/ |__/ \___/ |__/ \__/|__/ \_______/|__/ \__/ \_______/|__/ |__/
#################################################################################################################################
Mutant Kraken is currently in beta and is not ready for production use.
To install:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap JosueMolinaMorales/mutant-kraken
brew install mutant-kraken
mutant-kraken -v
You can also install Mutant-Kraken with the Rust toolchain:
cargo install mutant-kraken
This will install Mutant-Kraken in ~/.cargo/bin
by default.
Mutant-Kraken is a mutation testing tool for Kotlin. It is currently in Beta. Please expect issues. If you come across any issues, please report them through the issues tab on the GitHub repository.
mutant-kraken help
or mutant-kraken -h
: Prints the help menu.mutant-kraken mutate [PATH]
: Runs the mutation testing tool on the path provided, or the current directory if no path is provided.mutant-kraken config
: Displays information about how to setup the config file.mutant-kraken clean
: Removes the mutant-kraken-dist directoryMutant-Kraken has 5 stages:
In this step, the tool looks at the given path and locates all potential Kotlin files to be mutated. It ignores any files that are not Kotlin files and follows the config that is provided.
If in the config you state that you do not want to mutate any files that end in Test.kt
, then it will ignore any files that end in Test.kt
. As well as ignoring any directories, for example the build
directory
Example mk.config.json file that ignores all files that end in Test.kt
and ignores the build
directory:
"ignore": {
"ignore_files": [
"^.*Test\\.[^.]*$"
],
"ignore_directories": [
"build",
]
}
In this step, the tool looks at each file and gathers all the mutations that can be made for each file. It then stores the mutations in a file called mutations.json
in the mutant-kraken-dist
directory.
In this step, the tool generates all the mutation files and stores them in the mutant-kraken-dist/mutations
directory.
In this step, the tool runs the tests for each mutation and stores the results in the mutant-kraken-dist/results
directory.
Replaces an arithmetic operator with a different arithmetic operator
Removes a unary operator
Replaces a logical operator with a different logical operator
Replaces a relational operator with a different relational operator
Replaces an assignment operator with a different assignment operator
Replaces a unary operator with a different unary operator
Replaces a not null assertion operator with a different not null assertion operator
Removes an elvis operator
Changes the literal of an elvis operator
Changes the literal of a literal
Changes the exception thrown
Removes a branch from the when statement if the statement has more than one branch
Removes a label when continuing, breaking, or returning
Changes first() to last() and vice versa or find() to findLast() and vice versa
Changes Any() to All() or None() and vice versa or ForEach() to Map() or Filter() and vice versa
Mutant-Kraken allows you to configure different aspects of the tool.
Here is a breakdown of what can be configured through the mutantkraken.config.json
file:
This configuration is general to the tool.
Timeout expects a number and will stop the program after a certain amount of seconds pass
By default, timeout is not set
Operators expects a list of the following string:
By default all operators are enabled
This configuration allows you to ignore files and directories using regex
Accepts a list of regex
By default it ignores all files that do not end in .kt
Accepts a list of regex
By default it ignores all build directories
The maxiumum amount of threads the tools is about to use
By default it is set to 30 threads
This allows for configuration of the output displayed for the tool
This expects a boolean where true means not to disable the end table
Defaults to false
Thi allows for configuration of the logging
This expects one of the following values:
Defaults to INFO
{
"general": {
"timeout": null,
"operators": [
"ArithmeticReplacementOperator",
"AssignmentReplacementOperator"
]
},
"ignore": {
"ignore_files": ["^.*Test\\.[^.]*$"],
"ignore_directories": ["dist", "build", "bin", ".gradle", ".idea", "gradle"]
},
"threading": { "max_threads": 30 },
"output": { "display_end_table": false },
"logging": { "log_level": "info" }
}
If you would like to contribute to Mutant-Kraken, please read the CONTRIBUTING.md file.
mutant-kraken-dist
directory to your .gitignore
file.