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]
Best fit
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.
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]GoogleTest 1.18.0 README(2026-10-04)
- [2]GoogleTest 1.18.0 CMake quickstart(2026-10-04)
- [3]GoogleTest 1.18.0 release(2026-10-04)
- [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
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
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
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
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++
- License
- BSD-3-Clause
- Repository last updated
- Oct 3, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Google Benchmark10,449 Stars
2 shared tag(s) · 1 shared category(s) · Same language
write C++ microbenchmarks with a unit-test-like API and measure timing, iterations, counters, and statistics
C++ - Jest45,471 Stars
2 shared tag(s) · 1 shared category(s)
Combine assertions, mocks, watch mode, snapshots, coverage, and worker isolation in one JavaScript test runner
TypeScript - Vitest17,180 Stars
2 shared tag(s) · 1 shared category(s)
reuse Vite transforms and configuration across Node, DOM, and Browser Mode tests
TypeScript - JUnit7,056 Stars
2 shared tag(s) · 1 shared category(s)
Java/JVM testing built on Platform and Jupiter
Java - MockK5,762 Stars
2 shared tag(s) · 1 shared category(s)
mock, stub, and verify Kotlin collaborators with coroutine and Android support
Kotlin - Kotest4,789 Stars
2 shared tag(s) · 1 shared category(s)
combine spec styles, assertions, and property testing across Kotlin projects
Kotlin
Report incorrect information
Tell us if any listing information is incorrect or outdated.