]>
Commit | Line | Data |
---|---|---|
9f95a23c | 1 | # Googletest Mocking (gMock) Framework |
7c673cae | 2 | |
9f95a23c | 3 | ### Overview |
7c673cae | 4 | |
9f95a23c TL |
5 | Google's framework for writing and using C++ mock classes. It can help you |
6 | derive better designs of your system and write better tests. | |
7c673cae FG |
7 | |
8 | It is inspired by: | |
9 | ||
f67539c2 TL |
10 | * [jMock](http://www.jmock.org/) |
11 | * [EasyMock](http://www.easymock.org/) | |
12 | * [Hamcrest](http://code.google.com/p/hamcrest/) | |
7c673cae | 13 | |
f67539c2 | 14 | It is designed with C++'s specifics in mind. |
7c673cae | 15 | |
9f95a23c TL |
16 | gMock: |
17 | ||
f67539c2 TL |
18 | - Provides a declarative syntax for defining mocks. |
19 | - Can define partial (hybrid) mocks, which are a cross of real and mock | |
20 | objects. | |
21 | - Handles functions of arbitrary types and overloaded functions. | |
22 | - Comes with a rich set of matchers for validating function arguments. | |
23 | - Uses an intuitive syntax for controlling the behavior of a mock. | |
24 | - Does automatic verification of expectations (no record-and-replay needed). | |
25 | - Allows arbitrary (partial) ordering constraints on function calls to be | |
26 | expressed. | |
27 | - Lets a user extend it by defining new matchers and actions. | |
28 | - Does not use exceptions. | |
29 | - Is easy to learn and use. | |
9f95a23c TL |
30 | |
31 | Details and examples can be found here: | |
32 | ||
33 | * [gMock for Dummies](docs/for_dummies.md) | |
34 | * [Legacy gMock FAQ](docs/gmock_faq.md) | |
35 | * [gMock Cookbook](docs/cook_book.md) | |
36 | * [gMock Cheat Sheet](docs/cheat_sheet.md) | |
37 | ||
f67539c2 TL |
38 | Please note that code under scripts/generator/ is from the |
39 | [cppclean project](http://code.google.com/p/cppclean/) and under the Apache | |
40 | License, which is different from GoogleMock's license. | |
9f95a23c | 41 | |
f67539c2 TL |
42 | GoogleMock is a part of |
43 | [GoogleTest C++ testing framework](http://github.com/google/googletest/) and a | |
9f95a23c | 44 | subject to the same requirements. |