Navigate:
GoogleTest
~$GOOGL0.1%

GoogleTest: C++ testing and mocking framework

xUnit-based C++ testing framework with integrated mocking.

LIVE RANKINGS • 12:32 PM • STEADY
OVERALL
#313
90
DEVELOPER TOOLS
#61
20
30 DAY RANKING TREND
ovr#313
·Devel#61
STARS
38.3K
FORKS
10.7K
7D STARS
+41
7D FORKS
+9
See Repo:
Share:

Learn more about GoogleTest

GoogleTest is a C++ unit testing framework based on the xUnit architecture that automates test discovery and execution. It is implemented in C++ and requires C++17 or later as of version 1.17.0. The framework supports both fatal and non-fatal test failures, value-parameterized tests with multiple input values, type-parameterized tests across different data types, and death tests for verifying program exit behavior. It is used in large-scale projects including Chromium, LLVM, Protocol Buffers, and OpenCV for validating C++ code correctness.

GoogleTest

1

Unified Testing Framework

Combines unit testing and mocking in a single maintained codebase, eliminating the need to manage separate GoogleTest and GoogleMock dependencies. Simplifies build configuration and version compatibility for projects requiring both capabilities.

2

Parameterized Test Variants

Supports value-parameterized tests with different input values and type-parameterized tests across multiple data types. Reduces code duplication when testing functions with varying inputs or validating generic implementations.

3

Death Test Support

Verifies that code properly terminates under expected conditions by testing exit codes and error messages. Death tests ensure crash handlers and fatal error paths work correctly without crashing the test runner itself.


#include <gtest/gtest.h>

int Add(int a, int b) { return a + b; }

TEST(MathTest, AdditionWorks) {
  EXPECT_EQ(Add(2, 3), 5);
  EXPECT_EQ(Add(-1, 1), 0);
  EXPECT_NE(Add(2, 2), 5);
}

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}



[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers