Skip to content

[FR]: Test names output by googletest are too long #4937

@geoff-m

Description

@geoff-m

Does the feature exist in the most recent commit?

No.

Why do we need this feature?

I have a test suite called AutoTest with a parameterized test called Compile. The parameter is a custom type. I provide a function as the 4th argument to INSTANTIATE_TEST_SUITE_P that generates test names based on the parameter. When googletest lists tests names, it prints stuff like A/AutoTest.Compile/firstpass_preproc_set # GetParam() = 64-byte object <10-61 1E-61 40-7B 00-00 2F-00 00-00 00-00 00-00 2F-00 00-00 00-00 00-00 BE-BE BE-BE BE-BE BE-BE 40-82 23-61 40-7C 00-00 01-00 00-00 00-00 00-00 00-00 00-40 00-00 00-00 00-00 00-00 00-00 00-00>. Everything following the string that my function generates ("firstpass_preproc_set" in this case) is basically undesired spam. It's just noise that takes up precious screen real estate.

Describe the proposal.

I suppose the intent behind " # GetParam() = . . ." was to print the parameter as a way to clarify which value is being used as the parameter to a TEST_P, but I (like most parameterized test users, I'd think?) already use the 4th argument to INSTANTIATE_TEST_SUITE_P to provide all the information I need to know about the value. There is nothing more of value to be printed aside from the name I'm already giving it.

I found a documented way to provide a custom string formatter for my parameter type, which I can make return an empty string, but googletest still outputs the undesired " # GetParam() = ".

I modified googletest to stop it from doing this (in UnitTestImpl::ListTestsMatchingFilter) but would love to know if there is an official way to get test names listed without the "# GetParam()" stuff. If there is no official way, please add one.

Is the feature specific to an operating system, compiler, or build system version?

No.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions