OSS TanbouSign in with GitHub

write C++ unit tests, assertions, parameterized tests, death tests, and mocks with Google's testing framework

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
39,616
Primary language
C++
License
BSD-3-Clause
Repository last updated
Oct 3, 2026
On this page

Overview

GoogleTest is Google's C++ testing and mocking framework. It combines xUnit-style test discovery and assertions with fatal/non-fatal failures, death tests, value- and type-parameterized tests, and GoogleMock in one repository.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Write unit tests with TEST/TEST_F and a rich assertion set

GoogleTest discovers test cases automatically and provides equality, inequality, exception, and other assertions for validating C++ behavior.

Sources: [1]

Use fixtures, parameterized tests, and death tests for broader coverage

Fixtures share setup, parameterized tests expand input and type combinations, and death tests validate error paths that are expected to terminate.

Sources: [1]

Integrate GoogleMock and CMake test discovery in the same toolchain

The formerly separate GoogleTest and GoogleMock projects are maintained together, and CMake consumers can link GTest::gtest_main and register tests with gtest_discover_tests.

Sources: [1][2]

Best fit

Fits C++ projects standardizing unit testing and mocking across local and CI builds

It covers small unit tests through parameterized and mocked tests and integrates with common CMake and Bazel workflows.

Sources: [1][2]

Before adoption

The 1.18.x line requires C++17 or newer

Starting with 1.18.0, supported builds require at least a C++17 compiler and standard library. Teams on older C++14 environments need to account for the support-policy change.

Sources: [1][3][2]

Release branches are maintenance-oriented while upstream also recommends the latest commit

The 1.18.0 release notes say the 1.18.x branch does not accept new feature patches and only exceptional critical fixes may land. Choose between a stable tag and tracking main based on reproducibility needs.

Sources: [3]

Official sources

  1. [1]GoogleTest 1.18.0 README(2026-10-04)
  2. [2]GoogleTest 1.18.0 CMake quickstart(2026-10-04)
  3. [3]GoogleTest 1.18.0 release(2026-10-04)
  4. [4]GoogleTest BSD 3-Clause license(2026-10-04)
Supplemental curator note

The 1.18.x line requires C++17 or newer. Release branches are maintenance-oriented and upstream also recommends latest commits, so pin the tag when reproducibility is more important than tracking main.

Try it in 3 steps

  1. 1

    Fetch GoogleTest v1.18.0

    Pin the stable C++17-baseline release tag.

    git clone --depth 1 --branch v1.18.0 https://github.com/google/googletest.git googletest-1.18.0
  2. 2

    Create a minimal CMake test project

    Use the local checkout through add_subdirectory and enable CMake test discovery.

    mkdir -p gtest-demo && printf '%s\n' 'cmake_minimum_required(VERSION 3.14)' 'project(gtest_demo LANGUAGES CXX)' 'set(CMAKE_CXX_STANDARD 17)' 'set(CMAKE_CXX_STANDARD_REQUIRED ON)' 'add_subdirectory(../googletest-1.18.0 googletest-build EXCLUDE_FROM_ALL)' 'enable_testing()' 'add_executable(hello_test hello_test.cc)' 'target_link_libraries(hello_test PRIVATE GTest::gtest_main)' 'include(GoogleTest)' 'gtest_discover_tests(hello_test)' > gtest-demo/CMakeLists.txt && printf '%s\n' '#include <gtest/gtest.h>' 'TEST(HelloTest, BasicAssertions) { EXPECT_EQ(7 * 6, 42); }' > gtest-demo/hello_test.cc
  3. 3

    Build and run the discovered test with CTest

    Build the GoogleTest binary and run the discovered test through CTest.

    cmake -S gtest-demo -B gtest-demo/build && cmake --build gtest-demo/build -j2 && ctest --test-dir gtest-demo/build --output-on-failure
Check the official README

Growth

Growth trends · Last 30 days

39,616 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
9
Open PRs
192

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data
Stars
39,616
Forks
10,909
Watchers
1,272
Open issues
329
Contributors
389
Owner type
Organization
Primary language
C++
Repository last updated
Oct 3, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?