1 |
2 |
jamieiles |
|
2 |
|
|
# Google Test #
|
3 |
|
|
|
4 |
|
|
[![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest)
|
5 |
|
|
[![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/BillyDonahue/googletest/branch/master)
|
6 |
|
|
|
7 |
|
|
Welcome to **Google Test**, Google's C++ test framework!
|
8 |
|
|
|
9 |
|
|
This repository is a merger of the formerly separate GoogleTest and
|
10 |
|
|
GoogleMock projects. These were so closely related that it makes sense to
|
11 |
|
|
maintain and release them together.
|
12 |
|
|
|
13 |
|
|
Please see the project page above for more information as well as the
|
14 |
|
|
mailing list for questions, discussions, and development. There is
|
15 |
|
|
also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
|
16 |
|
|
join us!
|
17 |
|
|
|
18 |
|
|
Getting started information for **Google Test** is available in the
|
19 |
|
|
[Google Test Primer](googletest/docs/Primer.md) documentation.
|
20 |
|
|
|
21 |
|
|
**Google Mock** is an extension to Google Test for writing and using C++ mock
|
22 |
|
|
classes. See the separate [Google Mock documentation](googlemock/README.md).
|
23 |
|
|
|
24 |
|
|
More detailed documentation for googletest (including build instructions) are
|
25 |
|
|
in its interior [googletest/README.md](googletest/README.md) file.
|
26 |
|
|
|
27 |
|
|
## Features ##
|
28 |
|
|
|
29 |
|
|
* An [XUnit](https://en.wikipedia.org/wiki/XUnit) test framework.
|
30 |
|
|
* Test discovery.
|
31 |
|
|
* A rich set of assertions.
|
32 |
|
|
* User-defined assertions.
|
33 |
|
|
* Death tests.
|
34 |
|
|
* Fatal and non-fatal failures.
|
35 |
|
|
* Value-parameterized tests.
|
36 |
|
|
* Type-parameterized tests.
|
37 |
|
|
* Various options for running the tests.
|
38 |
|
|
* XML test report generation.
|
39 |
|
|
|
40 |
|
|
## Platforms ##
|
41 |
|
|
|
42 |
|
|
Google test has been used on a variety of platforms:
|
43 |
|
|
|
44 |
|
|
* Linux
|
45 |
|
|
* Mac OS X
|
46 |
|
|
* Windows
|
47 |
|
|
* Cygwin
|
48 |
|
|
* MinGW
|
49 |
|
|
* Windows Mobile
|
50 |
|
|
* Symbian
|
51 |
|
|
|
52 |
|
|
## Who Is Using Google Test? ##
|
53 |
|
|
|
54 |
|
|
In addition to many internal projects at Google, Google Test is also used by
|
55 |
|
|
the following notable projects:
|
56 |
|
|
|
57 |
|
|
* The [Chromium projects](http://www.chromium.org/) (behind the Chrome
|
58 |
|
|
browser and Chrome OS).
|
59 |
|
|
* The [LLVM](http://llvm.org/) compiler.
|
60 |
|
|
* [Protocol Buffers](https://github.com/google/protobuf), Google's data
|
61 |
|
|
interchange format.
|
62 |
|
|
* The [OpenCV](http://opencv.org/) computer vision library.
|
63 |
|
|
|
64 |
|
|
## Related Open Source Projects ##
|
65 |
|
|
|
66 |
|
|
[Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs
|
67 |
|
|
your test binary, allows you to track its progress via a progress bar, and
|
68 |
|
|
displays a list of test failures. Clicking on one shows failure text. Google
|
69 |
|
|
Test UI is written in C#.
|
70 |
|
|
|
71 |
|
|
[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event
|
72 |
|
|
listener for Google Test that implements the
|
73 |
|
|
[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test
|
74 |
|
|
result output. If your test runner understands TAP, you may find it useful.
|
75 |
|
|
|
76 |
|
|
## Requirements ##
|
77 |
|
|
|
78 |
|
|
Google Test is designed to have fairly minimal requirements to build
|
79 |
|
|
and use with your projects, but there are some. Currently, we support
|
80 |
|
|
Linux, Windows, Mac OS X, and Cygwin. We will also make our best
|
81 |
|
|
effort to support other platforms (e.g. Solaris, AIX, and z/OS).
|
82 |
|
|
However, since core members of the Google Test project have no access
|
83 |
|
|
to these platforms, Google Test may have outstanding issues there. If
|
84 |
|
|
you notice any problems on your platform, please notify
|
85 |
|
|
. Patches for fixing them are
|
86 |
|
|
even more welcome!
|
87 |
|
|
|
88 |
|
|
### Linux Requirements ###
|
89 |
|
|
|
90 |
|
|
These are the base requirements to build and use Google Test from a source
|
91 |
|
|
package (as described below):
|
92 |
|
|
|
93 |
|
|
* GNU-compatible Make or gmake
|
94 |
|
|
* POSIX-standard shell
|
95 |
|
|
* POSIX(-2) Regular Expressions (regex.h)
|
96 |
|
|
* A C++98-standard-compliant compiler
|
97 |
|
|
|
98 |
|
|
### Windows Requirements ###
|
99 |
|
|
|
100 |
|
|
* Microsoft Visual C++ v7.1 or newer
|
101 |
|
|
|
102 |
|
|
### Cygwin Requirements ###
|
103 |
|
|
|
104 |
|
|
* Cygwin v1.5.25-14 or newer
|
105 |
|
|
|
106 |
|
|
### Mac OS X Requirements ###
|
107 |
|
|
|
108 |
|
|
* Mac OS X v10.4 Tiger or newer
|
109 |
|
|
* Xcode Developer Tools
|
110 |
|
|
|
111 |
|
|
### Requirements for Contributors ###
|
112 |
|
|
|
113 |
|
|
We welcome patches. If you plan to contribute a patch, you need to
|
114 |
|
|
build Google Test and its own tests from a git checkout (described
|
115 |
|
|
below), which has further requirements:
|
116 |
|
|
|
117 |
|
|
* [Python](https://www.python.org/) v2.3 or newer (for running some of
|
118 |
|
|
the tests and re-generating certain source files from templates)
|
119 |
|
|
* [CMake](https://cmake.org/) v2.6.4 or newer
|
120 |
|
|
|
121 |
|
|
## Regenerating Source Files ##
|
122 |
|
|
|
123 |
|
|
Some of Google Test's source files are generated from templates (not
|
124 |
|
|
in the C++ sense) using a script.
|
125 |
|
|
For example, the
|
126 |
|
|
file include/gtest/internal/gtest-type-util.h.pump is used to generate
|
127 |
|
|
gtest-type-util.h in the same directory.
|
128 |
|
|
|
129 |
|
|
You don't need to worry about regenerating the source files
|
130 |
|
|
unless you need to modify them. You would then modify the
|
131 |
|
|
corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)'
|
132 |
|
|
generator script. See the [Pump Manual](googletest/docs/PumpManual.md).
|
133 |
|
|
|
134 |
|
|
### Contributing Code ###
|
135 |
|
|
|
136 |
|
|
We welcome patches. Please read the
|
137 |
|
|
[Developer's Guide](googletest/docs/DevGuide.md)
|
138 |
|
|
for how you can contribute. In particular, make sure you have signed
|
139 |
|
|
the Contributor License Agreement, or we won't be able to accept the
|
140 |
|
|
patch.
|
141 |
|
|
|
142 |
|
|
Happy testing!
|