Tests with runtime skips

⚓ rust    📅 2025-04-26    👤 surdeus    👁️ 1      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Tests with runtime skips

I really like the cargo test feature. I've read/heard people complain that it's too bare bones, but I think that's a big part of why I think it's so good -- it just differentiates between things that go "boom!" and things that don't, and that's basically it.

With that said -- I've run into a situation where the the love of the bare bonedness has come back to bite me.

I have a some tests that need a test server to run. What I've done is make it so the tests check for the environment variable TEST_SERVER, and if it is set they run their test, otherwise they just exit cleanly. This works fine. However, I thought I was running the tests at one point, but I has misspelled the environment variable name. This would have been easily caught if the tests would report back as having been skipped.

I read somewhere that there are alternative testing frameworks for Rust, sort of like how criterion can replace cargo bench. Does anyone have any experience with such projects? My needs are very modest -- the only thing I really need is to be able to report that a test has been skipped.

4 posts - 3 participants

Read full topic

🏷️ rust_feed