2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 02:17:02 +03:00
|
|
|
Welcome to **Google Test**, Google's C++ test framework!
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
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.
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
## Google Test ##
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
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
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
## Platforms ##
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
Google test has been used on a variety of platforms:
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
* Linux
|
|
|
|
* Mac OS X
|
|
|
|
* Windows
|
|
|
|
* Cygwin
|
|
|
|
* MinGW
|
|
|
|
* Windows Mobile
|
|
|
|
* Symbian
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
## Who Is Using Google Test? ##
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
In addition to many internal projects at Google, Google Test is also used by
|
|
|
|
the following notable projects:
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
* 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.
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
## Related Open Source Projects ##
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
[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#.
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
[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.
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
## About Google Mock ##
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
**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.
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
Google mock:
|
2015-08-25 01:41:02 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
* 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.
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
We hope you find it useful!
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
## 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).
|
2015-08-26 00:56:57 +03:00
|
|
|
|
|
|
|
## Getting Started ##
|
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
If you are new to the project, we suggest that you read the user
|
|
|
|
documentation in the following order:
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
* Learn the [basics](http://code.google.com/p/googletest/wiki/Primer) of
|
|
|
|
Google Test, if you choose to use Google Mock with it (recommended).
|
2015-08-26 01:23:36 +03:00
|
|
|
* Read [Google Mock for Dummies](ForDummies.md).
|
2015-08-27 01:28:20 +03:00
|
|
|
* Read the instructions on how to [build Google Mock](googlemock/README.md).
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM) on Google Mock's usage and implementation.
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
Once you understand the basics, check out the rest of the docs:
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
* [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.
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-26 01:23:36 +03:00
|
|
|
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).
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
### 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)'
|
2015-08-27 01:29:25 +03:00
|
|
|
generator script. See the [Pump Manual](googletest/docs/PumpManual.md).
|
2015-08-27 01:28:20 +03:00
|
|
|
|
|
|
|
### 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.
|
2015-08-26 00:56:57 +03:00
|
|
|
|
2015-08-27 01:28:20 +03:00
|
|
|
Happy testing!
|