Necessist

Runs tests with statements and method calls removed to help identify broken tests

cargo install necessist

Illustrative example

The following hypothetical test verifies that a login mechanism works. Suppose the test would pass if session.send_password(...) were removed. This could indicate that the wrong condition is checked thereafter. Or worse, it could indicate a bug in the login mechanism.

```rust

[test]

fn loginworks() { let session = Session::new(URL); session.sendusername(USERNAME).unwrap(); session.send_password(PASSWORD).unwrap(); // <-- Test passes when removed assert!(session.read().unwrap().contains(WELCOME)); } ```

Necessist iteratively removes statements and method calls from tests and then runs them help identify such cases.

Usage

``` necessist 0.1.0-beta.0

USAGE: necessist [OPTIONS] [TEST_FILES]...

ARGS: ... Test files to mutilate (optional)

OPTIONS: --dump Dump the contents of the sqlite database to the console --framework Assume testing framework is [possible values: auto, hardhat-ts, rust] -h, --help Print help information --keep-going Continue when a dry run fails or a test cannot be run --no-dry-run Do not perform dry runs --quiet Do not output to the console --resume Resume from the sqlite database; implies --sqlite --root Root directory of the project under test --sqlite Output to a sqlite database in addition to the console --timeout Maximum number of seconds to run any test; 60 is the default, 0 means no timeout -V, --version Print version information --verbose Show test outcomes besides passed ```

By default, Necessist outputs to the console. Passing --sqlite causes Necessist to instead output to a sqlite database. A tool like sqlitebrowser can then be used to filter/sort the results.

Generally speaking, Necessist will not attempt to remove a statement if it is one the following:

Also, for some frameworks, certain statements and methods are ignored (see below).

Output

By default, Necessist outputs only when tests pass. Passing --verbose causes Necessist to instead output all of the removal outcomes below.

| Outcome | Meaning (With the statement/method call removed...) | | -------------------------------------------- | --------------------------------------------------- | | passed | The test(s) built and passed. | | timed-out | The test(s) built but timed-out. | | failed | The test(s) built but failed. | | nonbuildable | The test(s) did not build. |

Supported frameworks

Supported framework specifics

Hardhat TS

TBD

Rust

Ignored macros

Ignored methods

Goals

References