本文介绍了我可以给gtest中的值参数化测试起更好的名字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在gtest中使用值参数化测试.例如,如果我写
I use value-parameterized tests in gtest. For example, if I write
INSTANTIATE_TEST_CASE_P(InstantiationName,
FooTest,
::testing::Values("meeny", "miny", "moe"));
然后在输出中,我看到测试名称,例如
then in the output I see test names such as
InstantiationName/FooTest.DoesBlah/0 for "meeny"
InstantiationName/FooTest.DoesBlah/1 for "miny"
InstantiationName/FooTest.DoesBlah/2 for "moe"
有什么方法可以使这些名称更有意义?我想看
Is there any way to make these names more meaningful? I'd like to see
InstantiationName/FooTest.DoesBlah/meeny
InstantiationName/FooTest.DoesBlah/miny
InstantiationName/FooTest.DoesBlah/moe
推荐答案
INSTANTIATE_TEST_CASE_P接受一个可选的第4个参数,可用于此目的.请参见 https://github. com/google/googletest/blob/master/googletest/include/gtest/gtest-param-test.h#L1409 .
INSTANTIATE_TEST_CASE_P accepts an optional 4th argument which can be used for this purpose. See https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-param-test.h#L1409.
这篇关于我可以给gtest中的值参数化测试起更好的名字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!