xref: /freebsd/contrib/googletest/README.md (revision 02e9120893770924227138ba49df1edb3896112a)
1# GoogleTest
2
3### Announcements
4
5#### Live at Head
6
7GoogleTest now follows the
8[Abseil Live at Head philosophy](https://abseil.io/about/philosophy#upgrade-support).
9We recommend
10[updating to the latest commit in the `main` branch as often as possible](https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-live-at-head-and-how-do-i-do-it).
11We do publish occasional semantic versions, tagged with
12`v${major}.${minor}.${patch}` (e.g. `v1.13.0`).
13
14#### Documentation Updates
15
16Our documentation is now live on GitHub Pages at
17https://google.github.io/googletest/. We recommend browsing the documentation on
18GitHub Pages rather than directly in the repository.
19
20#### Release 1.13.0
21
22[Release 1.13.0](https://github.com/google/googletest/releases/tag/v1.13.0) is
23now available.
24
25The 1.13.x branch requires at least C++14.
26
27#### Continuous Integration
28
29We use Google's internal systems for continuous integration. \
30GitHub Actions were added for the convenience of open-source contributors. They
31are exclusively maintained by the open-source community and not used by the
32GoogleTest team.
33
34#### Coming Soon
35
36*   We are planning to take a dependency on
37    [Abseil](https://github.com/abseil/abseil-cpp).
38*   More documentation improvements are planned.
39
40## Welcome to **GoogleTest**, Google's C++ test framework!
41
42This repository is a merger of the formerly separate GoogleTest and GoogleMock
43projects. These were so closely related that it makes sense to maintain and
44release them together.
45
46### Getting Started
47
48See the [GoogleTest User's Guide](https://google.github.io/googletest/) for
49documentation. We recommend starting with the
50[GoogleTest Primer](https://google.github.io/googletest/primer.html).
51
52More information about building GoogleTest can be found at
53[googletest/README.md](googletest/README.md).
54
55## Features
56
57*   xUnit test framework: \
58    Googletest is based on the [xUnit](https://en.wikipedia.org/wiki/XUnit)
59    testing framework, a popular architecture for unit testing
60*   Test discovery: \
61    Googletest automatically discovers and runs your tests, eliminating the need
62    to manually register your tests
63*   Rich set of assertions: \
64    Googletest provides a variety of assertions, such as equality, inequality,
65    exceptions, and more, making it easy to test your code
66*   User-defined assertions: \
67    You can define your own assertions with Googletest, making it simple to
68    write tests that are specific to your code
69*   Death tests: \
70    Googletest supports death tests, which verify that your code exits in a
71    certain way, making it useful for testing error-handling code
72*   Fatal and non-fatal failures: \
73    You can specify whether a test failure should be treated as fatal or
74    non-fatal with Googletest, allowing tests to continue running even if a
75    failure occurs
76*   Value-parameterized tests: \
77    Googletest supports value-parameterized tests, which run multiple times with
78    different input values, making it useful for testing functions that take
79    different inputs
80*   Type-parameterized tests: \
81    Googletest also supports type-parameterized tests, which run with different
82    data types, making it useful for testing functions that work with different
83    data types
84*   Various options for running tests: \
85    Googletest provides many options for running tests including running
86    individual tests, running tests in a specific order and running tests in
87    parallel
88
89## Supported Platforms
90
91GoogleTest follows Google's
92[Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support).
93See
94[this table](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)
95for a list of currently supported versions of compilers, platforms, and build
96tools.
97
98## Who Is Using GoogleTest?
99
100In addition to many internal projects at Google, GoogleTest is also used by the
101following notable projects:
102
103*   The [Chromium projects](http://www.chromium.org/) (behind the Chrome browser
104    and Chrome OS).
105*   The [LLVM](http://llvm.org/) compiler.
106*   [Protocol Buffers](https://github.com/google/protobuf), Google's data
107    interchange format.
108*   The [OpenCV](http://opencv.org/) computer vision library.
109
110## Related Open Source Projects
111
112[GTest Runner](https://github.com/nholthaus/gtest-runner) is a Qt5 based
113automated test-runner and Graphical User Interface with powerful features for
114Windows and Linux platforms.
115
116[GoogleTest UI](https://github.com/ospector/gtest-gbar) is a test runner that
117runs your test binary, allows you to track its progress via a progress bar, and
118displays a list of test failures. Clicking on one shows failure text. GoogleTest
119UI is written in C#.
120
121[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event
122listener for GoogleTest that implements the
123[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test
124result output. If your test runner understands TAP, you may find it useful.
125
126[gtest-parallel](https://github.com/google/gtest-parallel) is a test runner that
127runs tests from your binary in parallel to provide significant speed-up.
128
129[GoogleTest Adapter](https://marketplace.visualstudio.com/items?itemName=DavidSchuldenfrei.gtest-adapter)
130is a VS Code extension allowing to view GoogleTest in a tree view and run/debug
131your tests.
132
133[C++ TestMate](https://github.com/matepek/vscode-catch2-test-adapter) is a VS
134Code extension allowing to view GoogleTest in a tree view and run/debug your
135tests.
136
137[Cornichon](https://pypi.org/project/cornichon/) is a small Gherkin DSL parser
138that generates stub code for GoogleTest.
139
140## Contributing Changes
141
142Please read
143[`CONTRIBUTING.md`](https://github.com/google/googletest/blob/main/CONTRIBUTING.md)
144for details on how to contribute to this project.
145
146Happy testing!
147