GTest (googletest) is Google's framework for writing C++ tests on a variety of platforms (Linux, Mac OS X, Windows, Cygwin, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, value- and type-parameterized tests, various options for running the tests, and XML test report generation.
The Mozilla build process will build GTest on supported platforms if you specify 'ac_add_options --enable-gtest'. This will compile and link any GTEST_*SRCS to libxul.so. To run the unit tests specify -unittest when invoking Gecko, optionally running from a debugger.
Running selected tests
Tests can select by using the <tt>GTEST_FILTER</tt> environment variable. See Running Test Programs: Running_a_Subset_of_the_Tests for more details.
GTest can be controlled from other environment variables. See Running Test Programs: Advanced Options for more details.
Writing a GTest Unit Test