Why does ```cargo test``` not print to stdout when executing


#1

I’m trying to do TDD and would like to run my entire project by putting executing code in my tests instead of in main. However when running cargo test it doesn’t execute any of the println!() macros, which is a bit of a pain.

Am I doing something wrong or is this usecase not supported? :slight_smile:


#2

From cargo test --help:

By default the rust test harness hides output from test execution to
keep results readable. Test output can be recovered (e.g. for debugging)
by passing `--nocapture` to the test binaries:

  cargo test -- --nocapture