How to Run All or One Rust Test with Cargo and Read the Results
Run all Rust tests or select one with Cargo, and understand passed, failed, ignored, and filtered-out counts.

If you are looking for a cargo run tests command, use cargo test instead. It compiles and executes tests, then reports their results. Pass a test name to narrow the run, or use --test when you need a test from a particular integration test target. The distinction matters: a name filter can select more than one test, so check both the names printed and the final counts.
Run the package's tests with cargo test
From your package, run:
cargo test
Cargo's test command documentation describes this as compiling and executing unit, integration, and documentation tests. Documentation tests run by default. Cargo also compiles included examples to check that they still compile. This is the command to choose when you want the broader test run rather than a quick check of one named test.
Read the results before changing any code: a completed command can report a failing test, while a passing result tells you which tests ran successfully. If a test depends on a file path, note that Cargo sets the working directory for each unit and integration test to the root of its package. That detail can explain why a relative path behaves differently from one you tried in another directory.
Select a test by name or choose an integration test target
To narrow the run by name, add a filter:
cargo test test_foo
test_foo is a filter, not a promise to run exactly one test. Cargo runs tests whose names match it. For example, the Rust By Example filtered run shows both test_foo and test_foo_bar running for that command. If your goal is to investigate one failure, inspect the printed test names rather than assuming the filter identified a single function.
For a test in a particular integration test target, first identify the relevant integration test in tests/. Each file there is a separate integration test. Substitute your target and test names into this documented command:
cargo test --test int_test_name -- modname::test_name
Here int_test_name stands for the integration test target, and modname::test_name stands for the test name to select within it. The --test option chooses the target; the name after -- goes to the test binary's test harness. Check the printed names and the passed or failed count to confirm that the intended test actually ran. Do not treat a command that selected no tests as proof that the test passed.
Read passed, failed, ignored, and filtered-out counts
The documented cargo test test_foo example reports:
running 2 tests
test test_foo ... ok
test test_foo_bar ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
This result says two tests ran and passed, none failed, none were ignored, and two were filtered out. The filtered-out tests did not match the selection; they are not two additional failures. The measured count is also zero in this example. When reading your own output, compare the named test lines with the totals: a passed count is useful only if the test you meant to select is among those that ran.
A filtered run answers a narrower question than the full command. Use it to focus on a matching name or an integration target, then use cargo test when you need the broader result, including documentation tests. If tests interfere with one another, Cargo may run multiple tests concurrently; the Rust book documents cargo test -- --test-threads=1 for running without test parallelism. That changes how the tests run, not which name filter you supplied.
