Running Test Programs - Advanced Options
Running a Subset of the Tests
If you set the GTEST_FILTER environment variable or the --gtest_filter flag to a filter string Google Test will only run those
tests whose full name match the filter.
Temporarily Disabling Tests
If you have a broken test that you cannot fix right away, you can add the DISABLED_ prefix to its name. This will exclude
it from execution.
* Note: This feature should only be used for temporary pain-relief. You still have to fix the disabled tests at a later time.
As a reminder, Google Test will print a banner warning you if a test program contains disabled tests.
Temporarily Enabling Disabled Tests
To include disabled tests in test execution, just invoke the test program with --gtest_also_run_disabled_tests or set the
GTEST_ALSO_RUN_DISABLED_TESTS environment variable to a value greater than 0.
Colored Terminal Output
You can set the GTEST_COLOR environment variable or set the --gtest_color command line flag to yes, no, or auto to
enable colors, disable colors or let Google Test decide.
Suppressing Elapsed Time
By default, Google Test prints the time it takes to run each test. To suppress that, run the program with the --
gtest_print_time=0 command line flag. Setting the GTEST_PRINT_TIME environment variable to 0 has the same effect.
Generating an XML Report
Google Test can emit a detailed XML report to a file in addition to its normal textual output. To generate the XML report,
set the GTEST_OUTPUT environment variable or the --gtest_output flag to the string “xml:path_to_output_file”, which will
create the file at the given location. You can also just use the string “xml”, in which case the output can be found in the
test_detail.xml file in the current directory. If the file already exists it will pick a different name (append number) to avoid
overwriting it.
The report uses a format based on the junitreport Ant task and can be parsed by popular Continuous Integration servers
like Hudson.