Controlling How Tests Are Run

In this chapter, we'll explore configure test execution with command-line options.

Controlling How Tests Are Run

Just as mana run compiles and runs code, mana test compiles code in test mode and runs the resulting test binary.

Running Tests in Parallel or Consecutively

By default, tests run in parallel. To run tests consecutively:

mana test -- --test-threads=1

Showing Function Output

By default, output from passing tests is captured. To see output:

mana test -- --show-output

Running a Subset of Tests

Run a single test by name:

mana test one_hundred

Run tests matching a pattern:

mana test add

This runs add_two_and_two, add_three_and_two, etc.

Ignoring Tests

Mark tests to ignore by default:

#[test]
#[ignore]
fn expensive_test() {
    // Code that takes a long time
}

Run only ignored tests:

mana test -- --ignored

Run all tests including ignored:

mana test -- --include-ignored

Continue to Test Organization.