Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run only integration tests

Tags:

rust

Is there a way to only run integration tests, but not unit-tests?

I've tried:

cargo test --tests: runs unit + integration tests

cargo test --test test_name: runs one specified test

Is it currently not possible to only run integration tests or am I missing something?

like image 620
jschw Avatar asked Sep 10 '25 18:09

jschw


2 Answers

You can run ONLY the integration tests by:

cargo test --test '*'

Please note that only '*' will work; neither * nor "*" works.

Reference: https://github.com/rust-lang/cargo/issues/8396

like image 93
Alan Zhiliang Feng Avatar answered Sep 12 '25 08:09

Alan Zhiliang Feng


I would like to supplement answer.

If you need to run only ONE integration test method (e.g. 'integration_test_method') you can do that by following command:

cargo test --test integration_tests 'integration_test_method' 

RUST_LOG=DEBUG RUST_BACKTRACE=full cargo test --test integration_tests 'integration_test_method' -- --exact --show-output --nocapture
like image 24
blandger Avatar answered Sep 12 '25 08:09

blandger