How to separate tests into two groups: unit and integration

⚓ Rust    📅 2025-06-19    👤 surdeus    👁️ 4      

surdeus

Warning

This post was published 55 days ago. The information described in this article may have changed.

I have an application with main.rs and I have a bunch of folders where I wrote parsers with unit-tests. But now I have several integration tests for exec part and I'd like to avoid to run them with cargo test command.

What I've tried:

  • Move integration tests outside of src/ folder into tests/ one but to make it run I needed to create lib.rs with all pub mod imports.
  • I tried features flags like cargo test --features exec-tests but it doesn't work and still run all tests
  • One thing that really works is that I mark integration tests as ignore and then run only ignored ones

I don't have any other ideas how I can separate running unit tests and integration ones.

2 posts - 2 participants

Read full topic

🏷️ rust_feed