Open didrocks opened 1 year ago
There's currently no way to get the description or name of a test from within it's body. There were discussions regarding having this functionality https://github.com/frondeus/test-case/issues/37, however we didn't implement anything this far.
It shouldn't be hard to add tc_context!()
macro to the scope of each test case, however I'm lagging with contributions to this crate due to a lot of things happening in my private life, so I won't be able to implement that any time soon. If you have time and energy to do that on your own we can discuss implementation details and I can review the code + release it, but that's about it.
I know there is separate https://crates.io/crates/function_name crate that gives such a macro. I wonder if this will work as workaround or even inspiration for this issue solution
@luke-biel: thanks for the honest feedback! I’m still unsure about my macro foo in rust so I will not tackle that right away before getting more familiar with the language.
@frondeus: I did try that the other day as a workaround, but the function name reported it the original function name (which is untouched in the DSL I guess). The only workaorund I found was to go through the thread name, (which work unless you force all your tests in a single thread).
Ah yes, I made test by myself, you are right. Those two macros are incompatible :(
I will think about the solution :)
Hey, great crate enabling to do table testing in Rust!
As part of most of the tests, I generate golden files after deserializing structs for instance or generated tree content. One way to identify them in a table testing environment is to generate based on the sub test name, and I feel the description will be really helpful for this.
Is there a way to get back the description within the test to achieve this? I would prefer not add an additional attribute and repeating the test description, but that’s a possible workaround.
Thanks!