| Crates.io | cargo-subunit |
| lib.rs | cargo-subunit |
| version | 0.1.1 |
| created_at | 2025-11-12 00:05:56.461783+00 |
| updated_at | 2025-11-12 00:33:47.98715+00 |
| description | Cargo extension to run tests and output results in subunit format |
| homepage | |
| repository | https://github.com/jelmer/cargo-subunit |
| max_upload_size | |
| id | 1928466 |
| size | 43,649 |
A Cargo extension that runs Rust tests and outputs results in subunit v2 format.
cargo install --path .
cargo subunit --list
This outputs test names in subunit v2 format using "exists" events. Each test is identified by its fully-qualified name (e.g., module::submodule::test_name). The output can be consumed by subunit tools or testrepository.
cargo subunit
The subunit v2 binary output is written to stdout. You can redirect it to a file:
cargo subunit > results.subunit
Pass test filters just like with cargo test:
cargo subunit test_name
cargo subunit module::
Create a file with test names (one per line):
echo "module::test_one" > tests.txt
echo "module::test_two" >> tests.txt
cargo subunit --load-list tests.txt
Any arguments after -- are forwarded to cargo test:
cargo subunit -- --nocapture
cargo subunit -- --test-threads=1
cargo-subunit integrates seamlessly with testrepository for tracking test history and running tests efficiently.
Create a .testr.conf file in your project root:
[DEFAULT]
test_command=cargo subunit $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
Then you can use testrepository commands:
# Run all tests and record results
testr run
# Run only failed tests from the last run
testr run --failing
# List test runs
testr last
# Show results from the last run
testr last --subunit | subunit-stats
cargo-subunit uses cargo test's unstable JSON output format (enabled via RUSTC_BOOTSTRAP=1) to capture test events, then converts them to subunit v2 format.
For --list mode:
exists event with the test IDFor running tests:
inprogress event when the test startssuccess, fail, skip, or fail (timeout) event when completesubunit crate for protocol serializationApache-2.0