README.md 4.59 KB
Newer Older
1

Billy Donahue's avatar
Billy Donahue committed
2
Welcome to **Google Test**, Google's C++ test framework!
3

Billy Donahue's avatar
Billy Donahue committed
4
5
6
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.
7

Billy Donahue's avatar
Billy Donahue committed
8
## Google Test ##
9

Billy Donahue's avatar
Billy Donahue committed
10
11
12
13
14
15
16
17
18
19
20
21
Google Test conforms to the [XUnit](https://en.wikipedia.org/wiki/XUnit)
test framework pattern. It features:

  * 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
22

Billy Donahue's avatar
Billy Donahue committed
23
## Platforms ##
24

Billy Donahue's avatar
Billy Donahue committed
25
Google test has been used on a variety of platforms:
26

Billy Donahue's avatar
Billy Donahue committed
27
28
29
30
31
32
33
  * Linux
  * Mac OS X
  * Windows
  * Cygwin
  * MinGW
  * Windows Mobile
  * Symbian
34

Billy Donahue's avatar
Billy Donahue committed
35
## Who Is Using Google Test? ##
36

Billy Donahue's avatar
Billy Donahue committed
37
38
In addition to many internal projects at Google, Google Test is also used by
the following notable projects:
39

Billy Donahue's avatar
Billy Donahue committed
40
41
42
43
44
45
  * The [Chromium projects](http://www.chromium.org/) (behind the Chrome
    browser and Chrome OS).
  * The [LLVM](http://llvm.org/) compiler.
  * [Protocol Buffers](http://code.google.com/p/protobuf/), Google's data
    interchange format.
  * The [OpenCV](http://opencv.org/) computer vision library.
46

Billy Donahue's avatar
Billy Donahue committed
47
## Related Open Source Projects ##
48

Billy Donahue's avatar
Billy Donahue committed
49
50
51
52
[Google Test UI](http://code.google.com/p/gtest-gbar/) 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#.
53

Billy Donahue's avatar
Billy Donahue committed
54
55
56
57
[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event
listener for Google Test that implements the
[TAP protocol](http://en.wikipedia.org/wiki/Test_Anything_Protocol) for test
result output. If your test runner understands TAP, you may find it useful.
58

Billy Donahue's avatar
Billy Donahue committed
59
## About Google Mock ##
60

Billy Donahue's avatar
Billy Donahue committed
61
62
63
**Google Mock** is an extension to Google Test for writing and using C++ mock classes.
It is inspired by [jMock](http://www.jmock.org/), [EasyMock](http://www.easymock.org/),
and [Hamcrest](http://code.google.com/p/hamcrest/), and designed with C++'s specifics in mind.
64

Billy Donahue's avatar
Billy Donahue committed
65
Google mock:
66

Billy Donahue's avatar
Billy Donahue committed
67
68
69
70
  * lets you create mock classes trivially using simple macros.
  * supports a rich set of matchers and actions.
  * handles unordered, partially ordered, or completely ordered expectations.
  * is extensible by users.
71

Billy Donahue's avatar
Billy Donahue committed
72
We hope you find it useful!
73

Billy Donahue's avatar
Billy Donahue committed
74
75
76
77
78
## Using Google Mock Without Google Test ## 
Google Mock is not a testing framework itself.  Instead, it needs a
testing framework for writing tests.  Google Mock works seamlessly
with [Google Test](http://code.google.com/p/googletest/), butj
you can also use it with [any C++ testing framework](googlemock/ForDummies.md#Using_Google_Mock_with_Any_Testing_Framework).
79
80
81

## Getting Started ##

Billy Donahue's avatar
Billy Donahue committed
82
83
If you are new to the project, we suggest that you read the user
documentation in the following order:
84

Billy Donahue's avatar
Billy Donahue committed
85
86
  * Learn the [basics](http://code.google.com/p/googletest/wiki/Primer) of
    Google Test, if you choose to use Google Mock with it (recommended).
Billy Donahue's avatar
Billy Donahue committed
87
  * Read [Google Mock for Dummies](ForDummies.md).
Billy Donahue's avatar
Billy Donahue committed
88
  * Read the instructions on how to [build Google Mock](googlemock/README.md).
89

Billy Donahue's avatar
Billy Donahue committed
90
You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM) on Google Mock's usage and implementation.
91

Billy Donahue's avatar
Billy Donahue committed
92
Once you understand the basics, check out the rest of the docs:
93

Billy Donahue's avatar
Billy Donahue committed
94
95
  * [CheatSheet](googlemock/docs/CheatSheet.md) - all the commonly used stuff at a glance.
  * [CookBook](googlemock/docs/CookBook.md) - recipes for getting things done, including advanced techniques.
96

Billy Donahue's avatar
Billy Donahue committed
97
98
99
If you need help, please check the [KnownIssues](googlemock/docs/KnownIssues.md) and
[FrequentlyAskedQuestions](googlemock/docs/frequentlyaskedquestions.md) before
posting a question on the [googlemock discussion group](http://groups.google.com/group/googlemock).
100

Billy Donahue's avatar
Billy Donahue committed
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
### Regenerating Source Files ###

Some of Google Test's source files are generated from templates (not
in the C++ sense) using a script.  A template file is named FOO.pump,
where FOO is the name of the file it will generate.  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](googletest/scripts/pump.py)'
generator script regenerate them.  See the
[Pump Manual](googletest/docs/PumpManual.md).

### Contributing Code ###

We welcome patches.  Please read the [Developer's Guide](docs/DevGuide.md)
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.
121

Billy Donahue's avatar
Billy Donahue committed
122
Happy testing!