Home > front end >  Tarpaulin running a subset of unit test
Tarpaulin running a subset of unit test

Time:02-03

I would like to know how to run a subset of tests using tarpaulin.

https://github.com/xd009642/tarpaulin - The documentation lists one argument --tests but that doesn't really provide a usage.

Using cargo, one can run tests such as:

cargo test <test_prefix> -- --nocapture

I would like to know how we can achieve the same using tarpaulin.

CodePudding user response:

The command line

cargo test <test_prefix> -- --nocapture

is actually the same as

cargo test -- <test_prefix> --nocapture

because Cargo has a special exception that if you are passing one argument that doesn't begin with - (usually a test filter), you don't need to bother writing -- too.

tarpaulin doesn't have that same special one-argument feature, but it does have -- <args> — so just use that.

cargo tarpaulin -- <test_prefix> --nocapture

Or perhaps the more conventional/universal ordering with options first

cargo tarpaulin -- --nocapture <test_prefix>

In general, all the options to tarpaulin go before the --, and all the options to the test binary (typically the built-in Rust test harness) go after it.

  • Related