README.md 4.36 KB
Newer Older
1

Billy Donahue's avatar
Billy Donahue committed
2
3
## Google Test ##

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

Billy Donahue's avatar
Billy Donahue committed
6
7
8
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.
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
64
65
66
**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.
67

Billy Donahue's avatar
Billy Donahue committed
68
Google mock:
69

Billy Donahue's avatar
Billy Donahue committed
70
71
72
73
  * 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.
74

Billy Donahue's avatar
Billy Donahue committed
75
We hope you find it useful!
76

Billy Donahue's avatar
Billy Donahue committed
77
78
### Using Google Mock Without Google Test ###

Billy Donahue's avatar
Billy Donahue committed
79
80
81
82
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).
83
84
85

## Getting Started ##

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

Billy Donahue's avatar
Billy Donahue committed
89
  * Learn the [basics](googletest/docs/Primer.md) of
Billy Donahue's avatar
Billy Donahue committed
90
    Google Test, if you choose to use Google Mock with it (recommended).
Billy Donahue's avatar
Billy Donahue committed
91
  * Read [Google Mock for Dummies](googlemock/docs/ForDummies.md).
Billy Donahue's avatar
Billy Donahue committed
92
  * Read the instructions on how to [build Google Mock](googlemock/README.md).
93

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

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

Billy Donahue's avatar
Billy Donahue committed
98
99
100
101
  * [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.
102

Billy Donahue's avatar
Billy Donahue committed
103
104
If you need help, please check the
[KnownIssues](googlemock/docs/KnownIssues.md) and
Billy Donahue's avatar
Billy Donahue committed
105
[FrequentlyAskedQuestions](googlemock/docs/frequentlyaskedquestions.md) before
Billy Donahue's avatar
Billy Donahue committed
106
107
posting a question on the
[discussion group](http://groups.google.com/group/googlemock).
108

Billy Donahue's avatar
Billy Donahue committed
109
110
111
### Regenerating Source Files ###

Some of Google Test's source files are generated from templates (not
Billy Donahue's avatar
Billy Donahue committed
112
in the C++ sense) using a script.
Billy Donahue's avatar
Billy Donahue committed
113
114
115
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)'
Billy Donahue's avatar
Billy Donahue committed
116
generator script.  See the [Pump Manual](googletest/docs/PumpManual.md).
Billy Donahue's avatar
Billy Donahue committed
117
118
119
120
121
122
123

### 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.
124

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