Criterion icon indicating copy to clipboard operation
Criterion copied to clipboard

Display parameter description for ParameterizedTest?

Open martijnthe opened this issue 7 years ago • 2 comments

I'm trying to use ParameterizedTest. So far so good. In the output I just see the same suite::name being logged every time for each parameter. Is there a way to make this a bit more meaningful by displaying a string description of the parameter?

FWIW, gtest does support this, see https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-param-test.h#L1409.

Assuming this is not supported, as a work-around, is there a way I can alter the name part from within the test function itself perhaps?

martijnthe avatar Jul 21 '17 14:07 martijnthe

There is currently no supported way to do so.

Even if you wanted to be really really naughty by changing criterion_current_test->name from within the test, the runner would get confused because an unknown test would start reporting its failures.

I think the best course of action for you at that point would be to use cr_log_* as a workaround to print which iteration you're in.

Snaipe avatar Jul 21 '17 14:07 Snaipe

@Snaipe Cool, thanks for the quick reply. I'll try logging as a work-around.

martijnthe avatar Jul 21 '17 15:07 martijnthe