Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | humble |
Last Updated | 2024-07-26 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.10.9006 |
gtest_vendor | 1.10.9006 |
README
Google Test
OSS Builds Status:
Future Plans
1.8.x Release:
the 1.8.x is the last release that works with pre-C++11 compilers. The 1.8.x will not accept any requests for any new features and any bugfix requests will only be accepted if proven “critical”
Post 1.8.x:
On-going work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release
Post 1.9.x
Post 1.9.x googletest will follow Abseil Live at Head philosophy
Welcome to Google Test, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Please subscribe to the mailing list at googletestframework@googlegroups.com for questions, discussions, and development.
Getting started:
The information for Google Test is available in the Google Test Primer documentation.
Google Mock is an extension to Google Test for writing and using C++ mock classes. See the separate Google Mock documentation.
More detailed documentation for googletest is in its interior googletest/README.md file.
Features
- An xUnit test framework.
- Test discovery.
- A rich set of assertions.
- User-defined assertions.
- Death tests.
- Fatal and non-fatal failures.
- Value-parameterized tests.
- Type-parameterized tests.
- Various options for running the tests.
- XML test report generation.
Platforms
Google test has been used on a variety of platforms:
- Linux
- Mac OS X
- Windows
- Cygwin
- MinGW
- Windows Mobile
- Symbian
- PlatformIO
Who Is Using Google Test?
In addition to many internal projects at Google, Google Test is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
- tiny-dnn: header only, dependency-free deep learning framework in C++11.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.
GTest TAP Listener is an event listener for Google Test that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view Google Tests in a tree view, and run/debug your tests.
Requirements
Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. If you notice any problems on your platform, please notify googletestframework@googlegroups.com. Patches for fixing them are welcome!
Build Requirements
These are the base requirements to build and use Google Test from a source package:
-
Bazel or CMake. NOTE: Bazel is the build system that googletest is using internally and tests against. CMake is community-supported.
-
a C++11-standard-compliant compiler
Contributing change
Please read the CONTRIBUTING.md
for details on how to
contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, please make an attempt to submit an internal change rather than a GitHub Pull Request. If you are not able to submit an internal change a PR is acceptable as an alternative.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v2.3 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.6.4 or newer
Developing Google Test and Google Mock
This section discusses how to make your own changes to the Google Test project.
Testing Google Test and Google Mock Themselves
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test and GoogleMock’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
To choose between building only Google Test or Google Mock, you may modify your cmake command to be one of each
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
Make sure you have Python installed, as some of Google Test’s tests are written
in Python. If the cmake command complains about not being able to find Python
(Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
), try telling it
explicitly where your Python executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python ...
Next, you can build Google Test and / or Google Mock and all desired tests. On *nix, this is usually done by
make
To run the tests, do
make test
All tests should pass.
Regenerating Source Files
Some of Google Test’s source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory.
You don’t need to worry about regenerating the source files unless you need to
modify them. You would then modify the corresponding .pump
files and run the
‘pump.py’ generator script. See the
Pump Manual.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | iron |
Last Updated | 2023-04-11 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.10.9005 |
gtest_vendor | 1.10.9005 |
README
Google Test
OSS Builds Status:
Future Plans
1.8.x Release:
the 1.8.x is the last release that works with pre-C++11 compilers. The 1.8.x will not accept any requests for any new features and any bugfix requests will only be accepted if proven “critical”
Post 1.8.x:
On-going work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release
Post 1.9.x
Post 1.9.x googletest will follow Abseil Live at Head philosophy
Welcome to Google Test, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Please subscribe to the mailing list at googletestframework@googlegroups.com for questions, discussions, and development.
Getting started:
The information for Google Test is available in the Google Test Primer documentation.
Google Mock is an extension to Google Test for writing and using C++ mock classes. See the separate Google Mock documentation.
More detailed documentation for googletest is in its interior googletest/README.md file.
Features
- An xUnit test framework.
- Test discovery.
- A rich set of assertions.
- User-defined assertions.
- Death tests.
- Fatal and non-fatal failures.
- Value-parameterized tests.
- Type-parameterized tests.
- Various options for running the tests.
- XML test report generation.
Platforms
Google test has been used on a variety of platforms:
- Linux
- Mac OS X
- Windows
- Cygwin
- MinGW
- Windows Mobile
- Symbian
- PlatformIO
Who Is Using Google Test?
In addition to many internal projects at Google, Google Test is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
- tiny-dnn: header only, dependency-free deep learning framework in C++11.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.
GTest TAP Listener is an event listener for Google Test that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view Google Tests in a tree view, and run/debug your tests.
Requirements
Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. If you notice any problems on your platform, please notify googletestframework@googlegroups.com. Patches for fixing them are welcome!
Build Requirements
These are the base requirements to build and use Google Test from a source package:
-
Bazel or CMake. NOTE: Bazel is the build system that googletest is using internally and tests against. CMake is community-supported.
-
a C++11-standard-compliant compiler
Contributing change
Please read the CONTRIBUTING.md
for details on how to
contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, please make an attempt to submit an internal change rather than a GitHub Pull Request. If you are not able to submit an internal change a PR is acceptable as an alternative.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v2.3 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.6.4 or newer
Developing Google Test and Google Mock
This section discusses how to make your own changes to the Google Test project.
Testing Google Test and Google Mock Themselves
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test and GoogleMock’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
To choose between building only Google Test or Google Mock, you may modify your cmake command to be one of each
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
Make sure you have Python installed, as some of Google Test’s tests are written
in Python. If the cmake command complains about not being able to find Python
(Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
), try telling it
explicitly where your Python executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python ...
Next, you can build Google Test and / or Google Mock and all desired tests. On *nix, this is usually done by
make
To run the tests, do
make test
All tests should pass.
Regenerating Source Files
Some of Google Test’s source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory.
You don’t need to worry about regenerating the source files unless you need to
modify them. You would then modify the corresponding .pump
files and run the
‘pump.py’ generator script. See the
Pump Manual.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | jazzy |
Last Updated | 2024-02-09 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.14.9000 |
gtest_vendor | 1.14.9000 |
README
GoogleTest
Announcements
Live at Head
GoogleTest now follows the
Abseil Live at Head philosophy.
We recommend
updating to the latest commit in the main
branch as often as possible.
We do publish occasional semantic versions, tagged with
v${major}.${minor}.${patch}
(e.g. v1.13.0
).
Documentation Updates
Our documentation is now live on GitHub Pages at https://google.github.io/googletest/. We recommend browsing the documentation on GitHub Pages rather than directly in the repository.
Release 1.13.0
Release 1.13.0 is now available.
The 1.13.x branch requires at least C++14.
Continuous Integration
We use Google’s internal systems for continuous integration.
GitHub Actions were added for the convenience of open-source contributors. They
are exclusively maintained by the open-source community and not used by the
GoogleTest team.
Coming Soon
- We are planning to take a dependency on Abseil.
- More documentation improvements are planned.
Welcome to GoogleTest, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Getting Started
See the GoogleTest User’s Guide for documentation. We recommend starting with the GoogleTest Primer.
More information about building GoogleTest can be found at googletest/README.md.
Features
- xUnit test framework:
Googletest is based on the xUnit testing framework, a popular architecture for unit testing - Test discovery:
Googletest automatically discovers and runs your tests, eliminating the need to manually register your tests - Rich set of assertions:
Googletest provides a variety of assertions, such as equality, inequality, exceptions, and more, making it easy to test your code - User-defined assertions:
You can define your own assertions with Googletest, making it simple to write tests that are specific to your code - Death tests:
Googletest supports death tests, which verify that your code exits in a certain way, making it useful for testing error-handling code - Fatal and non-fatal failures:
You can specify whether a test failure should be treated as fatal or non-fatal with Googletest, allowing tests to continue running even if a failure occurs - Value-parameterized tests:
Googletest supports value-parameterized tests, which run multiple times with different input values, making it useful for testing functions that take different inputs - Type-parameterized tests:
Googletest also supports type-parameterized tests, which run with different data types, making it useful for testing functions that work with different data types - Various options for running tests:
Googletest provides many options for running tests including running individual tests, running tests in a specific order and running tests in parallel
Supported Platforms
GoogleTest follows Google’s Foundational C++ Support Policy. See this table for a list of currently supported versions of compilers, platforms, and build tools.
Who Is Using GoogleTest?
In addition to many internal projects at Google, GoogleTest is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
GoogleTest UI is a test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. GoogleTest UI is written in C#.
GTest TAP Listener is an event listener for GoogleTest that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
C++ TestMate is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
Cornichon is a small Gherkin DSL parser that generates stub code for GoogleTest.
Contributing Changes
Please read
CONTRIBUTING.md
for details on how to contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, please make an attempt to submit an internal contribution rather than a GitHub Pull Request. If you are not able to submit internally, a PR is acceptable as an alternative.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting.
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v3.6 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.8.12 or newer
Developing Google Test and Google Mock
This section discusses how to make your own changes to the Google Test project.
Testing Google Test and Google Mock Themselves
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test and GoogleMock’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
To choose between building only Google Test or Google Mock, you may modify your cmake command to be one of each
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
Make sure you have Python installed, as some of Google Test’s tests are written
in Python. If the cmake command complains about not being able to find Python
(Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
), try telling it
explicitly where your Python executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python ...
Next, you can build Google Test and / or Google Mock and all desired tests. On *nix, this is usually done by
make
To run the tests, do
make test
All tests should pass.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2024-12-01 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.15.0 |
gtest_vendor | 1.15.0 |
README
GoogleTest
Announcements
Live at Head
GoogleTest now follows the
Abseil Live at Head philosophy.
We recommend
updating to the latest commit in the main
branch as often as possible.
We do publish occasional semantic versions, tagged with
v${major}.${minor}.${patch}
(e.g. v1.13.0
).
Documentation Updates
Our documentation is now live on GitHub Pages at https://google.github.io/googletest/. We recommend browsing the documentation on GitHub Pages rather than directly in the repository.
Release 1.13.0
Release 1.13.0 is now available.
The 1.13.x branch requires at least C++14.
Continuous Integration
We use Google’s internal systems for continuous integration.
GitHub Actions were added for the convenience of open-source contributors. They
are exclusively maintained by the open-source community and not used by the
GoogleTest team.
Coming Soon
- We are planning to take a dependency on Abseil.
- More documentation improvements are planned.
Welcome to GoogleTest, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Getting Started
See the GoogleTest User’s Guide for documentation. We recommend starting with the GoogleTest Primer.
More information about building GoogleTest can be found at googletest/README.md.
Features
- xUnit test framework:
Googletest is based on the xUnit testing framework, a popular architecture for unit testing - Test discovery:
Googletest automatically discovers and runs your tests, eliminating the need to manually register your tests - Rich set of assertions:
Googletest provides a variety of assertions, such as equality, inequality, exceptions, and more, making it easy to test your code - User-defined assertions:
You can define your own assertions with Googletest, making it simple to write tests that are specific to your code - Death tests:
Googletest supports death tests, which verify that your code exits in a certain way, making it useful for testing error-handling code - Fatal and non-fatal failures:
You can specify whether a test failure should be treated as fatal or non-fatal with Googletest, allowing tests to continue running even if a failure occurs - Value-parameterized tests:
Googletest supports value-parameterized tests, which run multiple times with different input values, making it useful for testing functions that take different inputs - Type-parameterized tests:
Googletest also supports type-parameterized tests, which run with different data types, making it useful for testing functions that work with different data types - Various options for running tests:
Googletest provides many options for running tests including running individual tests, running tests in a specific order and running tests in parallel
Supported Platforms
GoogleTest follows Google’s Foundational C++ Support Policy. See this table for a list of currently supported versions of compilers, platforms, and build tools.
Who Is Using GoogleTest?
In addition to many internal projects at Google, GoogleTest is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
GoogleTest UI is a test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. GoogleTest UI is written in C#.
GTest TAP Listener is an event listener for GoogleTest that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
C++ TestMate is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
Cornichon is a small Gherkin DSL parser that generates stub code for GoogleTest.
Contributing Changes
Please read
CONTRIBUTING.md
for details on how to contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, please make an attempt to submit an internal contribution rather than a GitHub Pull Request. If you are not able to submit internally, a PR is acceptable as an alternative.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting.
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v3.6 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.8.12 or newer
Developing Google Test and Google Mock
This section discusses how to make your own changes to the Google Test project.
Testing Google Test and Google Mock Themselves
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test and GoogleMock’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
To choose between building only Google Test or Google Mock, you may modify your cmake command to be one of each
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
Make sure you have Python installed, as some of Google Test’s tests are written
in Python. If the cmake command complains about not being able to find Python
(Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
), try telling it
explicitly where your Python executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python ...
Next, you can build Google Test and / or Google Mock and all desired tests. On *nix, this is usually done by
make
To run the tests, do
make test
All tests should pass.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | ardent |
Last Updated | 2017-08-08 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.8.0 |
gtest_vendor | 1.8.0 |
README
Google Test
Welcome to Google Test, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Please see the project page above for more information as well as the mailing list for questions, discussions, and development. There is also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please join us!
Getting started information for Google Test is available in the Google Test Primer documentation.
Google Mock is an extension to Google Test for writing and using C++ mock classes. See the separate Google Mock documentation.
More detailed documentation for googletest (including build instructions) are in its interior googletest/README.md file.
Features
- An XUnit test framework.
- Test discovery.
- A rich set of assertions.
- User-defined assertions.
- Death tests.
- Fatal and non-fatal failures.
- Value-parameterized tests.
- Type-parameterized tests.
- Various options for running the tests.
- XML test report generation.
Platforms
Google test has been used on a variety of platforms:
- Linux
- Mac OS X
- Windows
- Cygwin
- MinGW
- Windows Mobile
- Symbian
Who Is Using Google Test?
In addition to many internal projects at Google, Google Test is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
Related Open Source Projects
Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.
GTest TAP Listener is an event listener for Google Test that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
Requirements
Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. Currently, we support Linux, Windows, Mac OS X, and Cygwin. We will also make our best effort to support other platforms (e.g. Solaris, AIX, and z/OS). However, since core members of the Google Test project have no access to these platforms, Google Test may have outstanding issues there. If you notice any problems on your platform, please notify googletestframework@googlegroups.com. Patches for fixing them are even more welcome!
Linux Requirements
These are the base requirements to build and use Google Test from a source package (as described below):
- GNU-compatible Make or gmake
- POSIX-standard shell
- POSIX(-2) Regular Expressions (regex.h)
- A C++98-standard-compliant compiler
Windows Requirements
- Microsoft Visual C++ v7.1 or newer
Cygwin Requirements
- Cygwin v1.5.25-14 or newer
Mac OS X Requirements
- Mac OS X v10.4 Tiger or newer
- Xcode Developer Tools
Requirements for Contributors
We welcome patches. If you plan to contribute a patch, you need to build Google Test and its own tests from a git checkout (described below), which has further requirements:
- Python v2.3 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.6.4 or newer
Regenerating Source Files
Some of Google Test’s source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory.
You don’t need to worry about regenerating the source files
unless you need to modify them. You would then modify the
corresponding .pump
files and run the ‘pump.py’
generator script. See the Pump Manual.
Contributing Code
We welcome patches. Please read the Developer’s Guide for how you can contribute. In particular, make sure you have signed the Contributor License Agreement, or we won’t be able to accept the patch.
Happy testing!
CONTRIBUTING
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | ros2 |
Last Updated | 2024-04-26 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.15.0 |
gtest_vendor | 1.15.0 |
README
GoogleTest
Announcements
Live at Head
GoogleTest now follows the
Abseil Live at Head philosophy.
We recommend
updating to the latest commit in the main
branch as often as possible.
We do publish occasional semantic versions, tagged with
v${major}.${minor}.${patch}
(e.g. v1.13.0
).
Documentation Updates
Our documentation is now live on GitHub Pages at https://google.github.io/googletest/. We recommend browsing the documentation on GitHub Pages rather than directly in the repository.
Release 1.13.0
Release 1.13.0 is now available.
The 1.13.x branch requires at least C++14.
Continuous Integration
We use Google’s internal systems for continuous integration.
GitHub Actions were added for the convenience of open-source contributors. They
are exclusively maintained by the open-source community and not used by the
GoogleTest team.
Coming Soon
- We are planning to take a dependency on Abseil.
- More documentation improvements are planned.
Welcome to GoogleTest, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Getting Started
See the GoogleTest User’s Guide for documentation. We recommend starting with the GoogleTest Primer.
More information about building GoogleTest can be found at googletest/README.md.
Features
- xUnit test framework:
Googletest is based on the xUnit testing framework, a popular architecture for unit testing - Test discovery:
Googletest automatically discovers and runs your tests, eliminating the need to manually register your tests - Rich set of assertions:
Googletest provides a variety of assertions, such as equality, inequality, exceptions, and more, making it easy to test your code - User-defined assertions:
You can define your own assertions with Googletest, making it simple to write tests that are specific to your code - Death tests:
Googletest supports death tests, which verify that your code exits in a certain way, making it useful for testing error-handling code - Fatal and non-fatal failures:
You can specify whether a test failure should be treated as fatal or non-fatal with Googletest, allowing tests to continue running even if a failure occurs - Value-parameterized tests:
Googletest supports value-parameterized tests, which run multiple times with different input values, making it useful for testing functions that take different inputs - Type-parameterized tests:
Googletest also supports type-parameterized tests, which run with different data types, making it useful for testing functions that work with different data types - Various options for running tests:
Googletest provides many options for running tests including running individual tests, running tests in a specific order and running tests in parallel
Supported Platforms
GoogleTest follows Google’s Foundational C++ Support Policy. See this table for a list of currently supported versions of compilers, platforms, and build tools.
Who Is Using GoogleTest?
In addition to many internal projects at Google, GoogleTest is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
GoogleTest UI is a test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. GoogleTest UI is written in C#.
GTest TAP Listener is an event listener for GoogleTest that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
C++ TestMate is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
Cornichon is a small Gherkin DSL parser that generates stub code for GoogleTest.
Contributing Changes
Please read
CONTRIBUTING.md
for details on how to contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, please make an attempt to submit an internal contribution rather than a GitHub Pull Request. If you are not able to submit internally, a PR is acceptable as an alternative.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting.
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v3.6 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.8.12 or newer
Developing Google Test and Google Mock
This section discusses how to make your own changes to the Google Test project.
Testing Google Test and Google Mock Themselves
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test and GoogleMock’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
To choose between building only Google Test or Google Mock, you may modify your cmake command to be one of each
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
Make sure you have Python installed, as some of Google Test’s tests are written
in Python. If the cmake command complains about not being able to find Python
(Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
), try telling it
explicitly where your Python executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python ...
Next, you can build Google Test and / or Google Mock and all desired tests. On *nix, this is usually done by
make
To run the tests, do
make test
All tests should pass.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | crystal |
Last Updated | 2019-01-04 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.8.0 |
gtest_vendor | 1.8.0 |
README
Google Test
Welcome to Google Test, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Please see the project page above for more information as well as the mailing list for questions, discussions, and development. There is also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please join us!
Getting started information for Google Test is available in the Google Test Primer documentation.
Google Mock is an extension to Google Test for writing and using C++ mock classes. See the separate Google Mock documentation.
More detailed documentation for googletest (including build instructions) are in its interior googletest/README.md file.
Features
- An xUnit test framework.
- Test discovery.
- A rich set of assertions.
- User-defined assertions.
- Death tests.
- Fatal and non-fatal failures.
- Value-parameterized tests.
- Type-parameterized tests.
- Various options for running the tests.
- XML test report generation.
Platforms
Google test has been used on a variety of platforms:
- Linux
- Mac OS X
- Windows
- Cygwin
- MinGW
- Windows Mobile
- Symbian
Who Is Using Google Test?
In addition to many internal projects at Google, Google Test is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
- tiny-dnn: header only, dependency-free deep learning framework in C++11.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.
GTest TAP Listener is an event listener for Google Test that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
Requirements
Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. Currently, we support Linux, Windows, Mac OS X, and Cygwin. We will also make our best effort to support other platforms (e.g. Solaris, AIX, and z/OS). However, since core members of the Google Test project have no access to these platforms, Google Test may have outstanding issues there. If you notice any problems on your platform, please notify googletestframework@googlegroups.com. Patches for fixing them are even more welcome!
Linux Requirements
These are the base requirements to build and use Google Test from a source package (as described below):
- GNU-compatible Make or gmake
- POSIX-standard shell
- POSIX(-2) Regular Expressions (regex.h)
- A C++98-standard-compliant compiler
Windows Requirements
- Microsoft Visual C++ 2010 or newer
Cygwin Requirements
- Cygwin v1.5.25-14 or newer
Mac OS X Requirements
- Mac OS X v10.4 Tiger or newer
- Xcode Developer Tools
Contributing change
Please read the CONTRIBUTING.md
for details on
how to contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
If you are a Googler, it is preferable to first create an internal change and have it reviewed and submitted, and then create an upstreaming pull request here.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here.
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v2.3 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.6.4 or newer
- GNU Build System including automake (>= 1.9), autoconf (>= 2.59), and libtool / libtoolize.
Developing Google Test
This section discusses how to make your own changes to Google Test.
Testing Google Test Itself
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON ${GTEST_DIR}
Make sure you have Python installed, as some of Google Test’s tests
are written in Python. If the cmake command complains about not being
able to find Python (Could NOT find PythonInterp (missing:
PYTHON_EXECUTABLE)
), try telling it explicitly where your Python
executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
Next, you can build Google Test and all of its own tests. On *nix, this is usually done by ‘make’. To run the tests, do
make test
All tests should pass.
Regenerating Source Files
Some of Google Test’s source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory.
You don’t need to worry about regenerating the source files
unless you need to modify them. You would then modify the
corresponding .pump
files and run the ‘pump.py’
generator script. See the Pump Manual.
Developing Google Mock
This section discusses how to make your own changes to Google Mock.
Testing Google Mock Itself
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test’s own tests. For that you’ll need Autotools. First, make sure you have followed the instructions above to configure Google Mock. Then, create a build output directory and enter it. Next,
${GMOCK_DIR}/configure # try --help for more info
Once you have successfully configured Google Mock, the build steps are standard for GNU-style OSS packages.
make # Standard makefile following GNU conventions
make check # Builds and runs all tests - all should pass.
Note that when building your project against Google Mock, you are building against Google Test as well. There is no need to configure Google Test separately.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | ros2 |
Last Updated | 2024-04-26 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.15.0 |
gtest_vendor | 1.15.0 |
README
GoogleTest
Announcements
Live at Head
GoogleTest now follows the
Abseil Live at Head philosophy.
We recommend
updating to the latest commit in the main
branch as often as possible.
We do publish occasional semantic versions, tagged with
v${major}.${minor}.${patch}
(e.g. v1.13.0
).
Documentation Updates
Our documentation is now live on GitHub Pages at https://google.github.io/googletest/. We recommend browsing the documentation on GitHub Pages rather than directly in the repository.
Release 1.13.0
Release 1.13.0 is now available.
The 1.13.x branch requires at least C++14.
Continuous Integration
We use Google’s internal systems for continuous integration.
GitHub Actions were added for the convenience of open-source contributors. They
are exclusively maintained by the open-source community and not used by the
GoogleTest team.
Coming Soon
- We are planning to take a dependency on Abseil.
- More documentation improvements are planned.
Welcome to GoogleTest, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Getting Started
See the GoogleTest User’s Guide for documentation. We recommend starting with the GoogleTest Primer.
More information about building GoogleTest can be found at googletest/README.md.
Features
- xUnit test framework:
Googletest is based on the xUnit testing framework, a popular architecture for unit testing - Test discovery:
Googletest automatically discovers and runs your tests, eliminating the need to manually register your tests - Rich set of assertions:
Googletest provides a variety of assertions, such as equality, inequality, exceptions, and more, making it easy to test your code - User-defined assertions:
You can define your own assertions with Googletest, making it simple to write tests that are specific to your code - Death tests:
Googletest supports death tests, which verify that your code exits in a certain way, making it useful for testing error-handling code - Fatal and non-fatal failures:
You can specify whether a test failure should be treated as fatal or non-fatal with Googletest, allowing tests to continue running even if a failure occurs - Value-parameterized tests:
Googletest supports value-parameterized tests, which run multiple times with different input values, making it useful for testing functions that take different inputs - Type-parameterized tests:
Googletest also supports type-parameterized tests, which run with different data types, making it useful for testing functions that work with different data types - Various options for running tests:
Googletest provides many options for running tests including running individual tests, running tests in a specific order and running tests in parallel
Supported Platforms
GoogleTest follows Google’s Foundational C++ Support Policy. See this table for a list of currently supported versions of compilers, platforms, and build tools.
Who Is Using GoogleTest?
In addition to many internal projects at Google, GoogleTest is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
GoogleTest UI is a test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. GoogleTest UI is written in C#.
GTest TAP Listener is an event listener for GoogleTest that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
C++ TestMate is a VS Code extension allowing to view GoogleTest in a tree view and run/debug your tests.
Cornichon is a small Gherkin DSL parser that generates stub code for GoogleTest.
Contributing Changes
Please read
CONTRIBUTING.md
for details on how to contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, please make an attempt to submit an internal contribution rather than a GitHub Pull Request. If you are not able to submit internally, a PR is acceptable as an alternative.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting.
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v3.6 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.8.12 or newer
Developing Google Test and Google Mock
This section discusses how to make your own changes to the Google Test project.
Testing Google Test and Google Mock Themselves
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test and GoogleMock’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
To choose between building only Google Test or Google Mock, you may modify your cmake command to be one of each
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
Make sure you have Python installed, as some of Google Test’s tests are written
in Python. If the cmake command complains about not being able to find Python
(Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
), try telling it
explicitly where your Python executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python ...
Next, you can build Google Test and / or Google Mock and all desired tests. On *nix, this is usually done by
make
To run the tests, do
make test
All tests should pass.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | dashing |
Last Updated | 2019-05-08 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.8.9000 |
gtest_vendor | 1.8.9000 |
README
Google Test
Future Plans:
- 1.8.x Release - the 1.8.x is the last release that works with pre-C++11 compilers. The 1.8.x will not accept any requests for any new features and any bugfix requests will only be accepted if proven “critical”
- Post 1.8.x - work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release
- Post 1.9.x googletest will follow Abseil Live at Head philosophy
Welcome to Google Test, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Please the mailing list at googletestframework@googlegroups.com for questions, discussions, and development.
There is also an IRC channel on OFTC (irc.oftc.net) #gtest available.
Getting started information for Google Test is available in the Google Test Primer documentation.
Google Mock is an extension to Google Test for writing and using C++ mock classes. See the separate Google Mock documentation.
More detailed documentation for googletest (including build instructions) are in its interior googletest/README.md file.
Features
- An xUnit test framework.
- Test discovery.
- A rich set of assertions.
- User-defined assertions.
- Death tests.
- Fatal and non-fatal failures.
- Value-parameterized tests.
- Type-parameterized tests.
- Various options for running the tests.
- XML test report generation.
Platforms
Google test has been used on a variety of platforms:
- Linux
- Mac OS X
- Windows
- Cygwin
- MinGW
- Windows Mobile
- Symbian
Who Is Using Google Test?
In addition to many internal projects at Google, Google Test is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
- tiny-dnn: header only, dependency-free deep learning framework in C++11.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.
GTest TAP Listener is an event listener for Google Test that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view Google Tests in a tree view, and run/debug your tests.
Requirements
Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. Currently, we support Linux, Windows, Mac OS X, and Cygwin. We will also make our best effort to support other platforms (e.g. Solaris, AIX, and z/OS). However, since core members of the Google Test project have no access to these platforms, Google Test may have outstanding issues there. If you notice any problems on your platform, please notify googletestframework@googlegroups.com. Patches for fixing them are even more welcome!
Linux Requirements
These are the base requirements to build and use Google Test from a source package (as described below):
- GNU-compatible Make or gmake
- POSIX-standard shell
- POSIX(-2) Regular Expressions (regex.h)
- A C++11-standard-compliant compiler
Windows Requirements
- Microsoft Visual C++ 2015 or newer
Cygwin Requirements
- Cygwin v1.5.25-14 or newer
Mac OS X Requirements
- Mac OS X v10.4 Tiger or newer
- Xcode Developer Tools
Contributing change
Please read the CONTRIBUTING.md
for details on
how to contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, you can either create an internal change or work on GitHub directly.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v2.3 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.6.4 or newer
- GNU Build System including automake (>= 1.9), autoconf (>= 2.59), and libtool / libtoolize.
Developing Google Test
This section discusses how to make your own changes to Google Test.
Testing Google Test Itself
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON ${GTEST_DIR}
Make sure you have Python installed, as some of Google Test’s tests
are written in Python. If the cmake command complains about not being
able to find Python (Could NOT find PythonInterp (missing:
PYTHON_EXECUTABLE)
), try telling it explicitly where your Python
executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
Next, you can build Google Test and all of its own tests. On *nix, this is usually done by ‘make’. To run the tests, do
make test
All tests should pass.
Regenerating Source Files
Some of Google Test’s source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory.
You don’t need to worry about regenerating the source files
unless you need to modify them. You would then modify the
corresponding .pump
files and run the ‘pump.py’
generator script. See the Pump Manual.
Developing Google Mock
This section discusses how to make your own changes to Google Mock.
Testing Google Mock Itself
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test’s own tests. For that you’ll need Autotools. First, make sure you have followed the instructions above to configure Google Mock. Then, create a build output directory and enter it. Next,
${GMOCK_DIR}/configure # try --help for more info
Once you have successfully configured Google Mock, the build steps are standard for GNU-style OSS packages.
make # Standard makefile following GNU conventions
make check # Builds and runs all tests - all should pass.
Note that when building your project against Google Mock, you are building against Google Test as well. There is no need to configure Google Test separately.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | galactic |
Last Updated | 2021-06-04 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.10.9003 |
gtest_vendor | 1.10.9003 |
README
Google Test
OSS Builds Status:
Future Plans
1.8.x Release:
the 1.8.x is the last release that works with pre-C++11 compilers. The 1.8.x will not accept any requests for any new features and any bugfix requests will only be accepted if proven “critical”
Post 1.8.x:
On-going work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release
Post 1.9.x
Post 1.9.x googletest will follow Abseil Live at Head philosophy
Welcome to Google Test, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Please subscribe to the mailing list at googletestframework@googlegroups.com for questions, discussions, and development.
Getting started:
The information for Google Test is available in the Google Test Primer documentation.
Google Mock is an extension to Google Test for writing and using C++ mock classes. See the separate Google Mock documentation.
More detailed documentation for googletest is in its interior googletest/README.md file.
Features
- An xUnit test framework.
- Test discovery.
- A rich set of assertions.
- User-defined assertions.
- Death tests.
- Fatal and non-fatal failures.
- Value-parameterized tests.
- Type-parameterized tests.
- Various options for running the tests.
- XML test report generation.
Platforms
Google test has been used on a variety of platforms:
- Linux
- Mac OS X
- Windows
- Cygwin
- MinGW
- Windows Mobile
- Symbian
- PlatformIO
Who Is Using Google Test?
In addition to many internal projects at Google, Google Test is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
- tiny-dnn: header only, dependency-free deep learning framework in C++11.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.
GTest TAP Listener is an event listener for Google Test that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view Google Tests in a tree view, and run/debug your tests.
Requirements
Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. If you notice any problems on your platform, please notify googletestframework@googlegroups.com. Patches for fixing them are welcome!
Build Requirements
These are the base requirements to build and use Google Test from a source package:
-
Bazel or CMake. NOTE: Bazel is the build system that googletest is using internally and tests against. CMake is community-supported.
-
a C++11-standard-compliant compiler
Contributing change
Please read the CONTRIBUTING.md
for details on how to
contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, please make an attempt to submit an internal change rather than a GitHub Pull Request. If you are not able to submit an internal change a PR is acceptable as an alternative.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v2.3 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.6.4 or newer
Developing Google Test and Google Mock
This section discusses how to make your own changes to the Google Test project.
Testing Google Test and Google Mock Themselves
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test and GoogleMock’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
To choose between building only Google Test or Google Mock, you may modify your cmake command to be one of each
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
Make sure you have Python installed, as some of Google Test’s tests are written
in Python. If the cmake command complains about not being able to find Python
(Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
), try telling it
explicitly where your Python executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python ...
Next, you can build Google Test and / or Google Mock and all desired tests. On *nix, this is usually done by
make
To run the tests, do
make test
All tests should pass.
Regenerating Source Files
Some of Google Test’s source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory.
You don’t need to worry about regenerating the source files unless you need to
modify them. You would then modify the corresponding .pump
files and run the
‘pump.py’ generator script. See the
Pump Manual.
Repository Summary
Checkout URI | https://github.com/ament/googletest.git |
VCS Type | git |
VCS Version | foxy |
Last Updated | 2021-08-31 |
Dev Status | MAINTAINED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
gmock_vendor | 1.8.9001 |
gtest_vendor | 1.8.9001 |
README
Google Test
Future Plans:
- 1.8.x Release - the 1.8.x is the last release that works with pre-C++11 compilers. The 1.8.x will not accept any requests for any new features and any bugfix requests will only be accepted if proven “critical”
- Post 1.8.x - work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release
- Post 1.9.x googletest will follow Abseil Live at Head philosophy
Welcome to Google Test, Google’s C++ test framework!
This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together.
Please the mailing list at googletestframework@googlegroups.com for questions, discussions, and development.
There is also an IRC channel on OFTC (irc.oftc.net) #gtest available.
Getting started information for Google Test is available in the Google Test Primer documentation.
Google Mock is an extension to Google Test for writing and using C++ mock classes. See the separate Google Mock documentation.
More detailed documentation for googletest (including build instructions) are in its interior googletest/README.md file.
Features
- An xUnit test framework.
- Test discovery.
- A rich set of assertions.
- User-defined assertions.
- Death tests.
- Fatal and non-fatal failures.
- Value-parameterized tests.
- Type-parameterized tests.
- Various options for running the tests.
- XML test report generation.
Platforms
Google test has been used on a variety of platforms:
- Linux
- Mac OS X
- Windows
- Cygwin
- MinGW
- Windows Mobile
- Symbian
Who Is Using Google Test?
In addition to many internal projects at Google, Google Test is also used by the following notable projects:
- The Chromium projects (behind the Chrome browser and Chrome OS).
- The LLVM compiler.
- Protocol Buffers, Google’s data interchange format.
- The OpenCV computer vision library.
- tiny-dnn: header only, dependency-free deep learning framework in C++11.
Related Open Source Projects
GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
Google Test UI is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#.
GTest TAP Listener is an event listener for Google Test that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.
gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.
GoogleTest Adapter is a VS Code extension allowing to view Google Tests in a tree view, and run/debug your tests.
Requirements
Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. Currently, we support Linux, Windows, Mac OS X, and Cygwin. We will also make our best effort to support other platforms (e.g. Solaris, AIX, and z/OS). However, since core members of the Google Test project have no access to these platforms, Google Test may have outstanding issues there. If you notice any problems on your platform, please notify googletestframework@googlegroups.com. Patches for fixing them are even more welcome!
Linux Requirements
These are the base requirements to build and use Google Test from a source package (as described below):
- GNU-compatible Make or gmake
- POSIX-standard shell
- POSIX(-2) Regular Expressions (regex.h)
- A C++11-standard-compliant compiler
Windows Requirements
- Microsoft Visual C++ 2015 or newer
Cygwin Requirements
- Cygwin v1.5.25-14 or newer
Mac OS X Requirements
- Mac OS X v10.4 Tiger or newer
- Xcode Developer Tools
Contributing change
Please read the CONTRIBUTING.md
for details on
how to contribute to this project.
Happy testing!
CONTRIBUTING
How to become a contributor and submit your own code
Contributor License Agreements
We’d love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you’re sure you own the intellectual property, then you’ll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you’ll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we’ll be able to accept your pull requests.
Are you a Googler?
If you are a Googler, you can either create an internal change or work on GitHub directly.
Contributing A Patch
- Submit an issue describing your proposed change to the issue tracker.
- Please don’t mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn’t have a corresponding issue in the issue tracker, please create one.
- Also, coordinate with team members that are listed on the issue in question. This ensures that work isn’t being duplicated and communicating your plan early also generally leads to better patches.
- If your proposed change is accepted, and you haven’t already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop and test your code changes.
- Ensure that your code adheres to the existing style in the sample to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request.
The Google Test and Google Mock Communities
The Google Test community exists primarily through the discussion group and the GitHub repository. Likewise, the Google Mock community exists primarily through their own discussion group. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here.
Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There’s never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion.
Sure, C++ testing is serious business and all that, but it’s also a lot of fun. Let’s keep it that way. Let’s strive to be one of the friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. You don’t have to actually submit code in order to sign up. Your participation itself is a valuable contribution.
Style
To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the google-styleguide project. All patches will be expected to conform to the style outlined here. Use .clang-format to check your formatting
Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, Google Mock, and their own tests from a git checkout, which has further requirements:
- Python v2.3 or newer (for running some of the tests and re-generating certain source files from templates)
- CMake v2.6.4 or newer
- GNU Build System including automake (>= 1.9), autoconf (>= 2.59), and libtool / libtoolize.
Developing Google Test
This section discusses how to make your own changes to Google Test.
Testing Google Test Itself
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test’s own tests. For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON ${GTEST_DIR}
Make sure you have Python installed, as some of Google Test’s tests
are written in Python. If the cmake command complains about not being
able to find Python (Could NOT find PythonInterp (missing:
PYTHON_EXECUTABLE)
), try telling it explicitly where your Python
executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
Next, you can build Google Test and all of its own tests. On *nix, this is usually done by ‘make’. To run the tests, do
make test
All tests should pass.
Regenerating Source Files
Some of Google Test’s source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory.
You don’t need to worry about regenerating the source files
unless you need to modify them. You would then modify the
corresponding .pump
files and run the ‘pump.py’
generator script. See the Pump Manual.
Developing Google Mock
This section discusses how to make your own changes to Google Mock.
Testing Google Mock Itself
To make sure your changes work as intended and don’t break existing functionality, you’ll want to compile and run Google Test’s own tests. For that you’ll need Autotools. First, make sure you have followed the instructions above to configure Google Mock. Then, create a build output directory and enter it. Next,
${GMOCK_DIR}/configure # try --help for more info
Once you have successfully configured Google Mock, the build steps are standard for GNU-style OSS packages.
make # Standard makefile following GNU conventions
make check # Builds and runs all tests - all should pass.
Note that when building your project against Google Mock, you are building against Google Test as well. There is no need to configure Google Test separately.