Repolode
google

google/googletest

GoogleTest is Google's C++ testing and mocking framework, providing xUnit-style tests, rich assertions, and GoogleMock.

Stars
39,713
Forks
10,935
Open issues
552
Last commit
8 hours ago

What is it?

GoogleTest is a C++ unit testing framework from Google, built on the xUnit architecture. It lets developers write test cases, group them into suites, and run them with automatic test discovery, so tests do not need to be registered by hand. The repository also merges the formerly separate GoogleMock project, which provides tools for creating mock objects to isolate code under test.

The framework offers a broad set of assertions for equality, inequality, exceptions and more, plus support for user-defined assertions. It includes death tests that verify code exits in a particular way, fatal and non-fatal failure handling, and value-parameterized and type-parameterized tests. Test runs can target individual tests, follow a specific order, or execute in parallel.

GoogleTest follows Google's Foundational C++ Support Policy for compilers and platforms, and the 1.18.x branch requires at least C++17. Projects such as Chromium, LLVM, Protocol Buffers and OpenCV use it, and a number of third-party runners and IDE adapters build on its output.

Key features

  • 01Automatic test discovery, so tests need no manual registration.
  • 02Broad assertion library including equality, exception checks and user-defined assertions.
  • 03Death tests that verify how code exits, useful for error-handling paths.
  • 04Value-parameterized and type-parameterized tests.
  • 05Fatal and non-fatal failure handling, with options to run tests individually, in order, or in parallel.
  • 06Includes GoogleMock for creating mock objects.

Use cases

  • Writing unit tests for a C++ library or application.
  • Isolating code under test by mocking its dependencies with GoogleMock.
  • Testing error-handling code with death tests.
  • Running large C++ test suites in parallel in CI.

Things to know

  • The 1.18.x branch requires at least C++17.
  • A future dependency on Abseil is planned.

In collections

Topics

FAQ

What is googletest?
GoogleTest is Google's C++ testing and mocking framework, providing xUnit-style tests, rich assertions, and GoogleMock. GoogleTest is a C++ unit testing framework from Google, built on the xUnit architecture. It lets developers write test cases, group them into suites, and run them with automatic test discovery, so tests do not need to be registered by hand. The repository also merges the formerly separate GoogleMock project, which provides tools for creating mock objects to isolate code under test.
Is googletest free to use? What license does it have?
googletest is open source under the BSD-3-Clause license. Check the license terms before using it in commercial products.
Is googletest still maintained?
Actively maintained. The last commit to googletest was on Nov 6, 2026.
What can I use googletest for?
Writing unit tests for a C++ library or application. Isolating code under test by mocking its dependencies with GoogleMock. Testing error-handling code with death tests. Running large C++ test suites in parallel in CI.
Where can I get googletest?
The source code and installation instructions are on GitHub: https://github.com/google/googletest

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects