One of my favourite features of Rust is the fact that testing and benchmarking is there out-of-the-box. I’d love to hear how others use testing in Rust; their experiences and how they use them.
Personally, I feel like I don’t utilise tests in Rust as effectively as I do in C#. I’m writing less tests, and I feel less confident about them. Maybe it’s because I spend more time rewriting the same sections of Rust code instead of blocking out functionality like I can in C# (a reflection on my lack of skill with Rust, rather than a reflection on the language), or maybe since I’ve been turning any tests without assertions into doc examples they’re just more spread out.
There are lots of places you can stick tests in Rust; my preference is to use an external tests crate, even though that makes internal code difficult to test.
As for benches, I find them excellent for prototyping ideas, verifying different ways to do things, and then keeping an eye on how changes impact performance. I find my benches start low-level, but then evolve into higher-level lines-in-the-sand.