Easy switch between normal and debugging output #297
fleetingbytes
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my project's test source files I was spending more and more time switching between a normal cucumber output and an output allowing me to debug my tests (with tracing integration 💟 ). Since I don't like to allow unused imports I was often spending time adjusting, commenting, or uncommenting multiple
use
statements in addition to commenting and uncommenting big chunks of my cucumber's call inasync fn main() {World::cucumber...}
. And I had to do this across multiple test source files and keep the imports and calling code mutually in sync.Now I think I have a solution where all it takes to switch between debug and normal output is to rewrite a single word in the code of a test source file. It goes like this:
This is my test helper crate test_utils.rs which defines the common things across my tests. It contains, among other things, this code:
Most crucially, test_utils defines the
debug_world
and thenormal_world
functions. I import them in my test source code like thisSo now I can just change between normal and debug output by replacing the in
debug_world as construct_world
withnormal_world as construct world
. A lot of the import clutter is kept hidden in the test_utils crate.Beta Was this translation helpful? Give feedback.
All reactions