Run only unit tests

A typical newbie question, I have written integration and unit test for my rust app. I am trying to run these tests seperately, I see doing cargo test --test '*' runs all integration tests. Is there way to run all unit tests alone ? When searched the forums I did find that suggestions to use same kind of test patterns to run specific tests, I was wondering if there is way to run all unit tests w/o running integration tests e.g. cargo test --test '!*'

You can use cargo test --lib if the tests are only in your library crate. You can also use --lib --bins to test the library crate and all of the binaries in the crate but not the tests in the tests directory

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.