128f6c2f2SEnji Cooper# Googletest Mocking (gMock) Framework 2b89a7cc2SEnji Cooper 328f6c2f2SEnji Cooper### Overview 4b89a7cc2SEnji Cooper 528f6c2f2SEnji CooperGoogle's framework for writing and using C++ mock classes. It can help you 628f6c2f2SEnji Cooperderive better designs of your system and write better tests. 7b89a7cc2SEnji Cooper 8b89a7cc2SEnji CooperIt is inspired by: 9b89a7cc2SEnji Cooper 1028f6c2f2SEnji Cooper* [jMock](http://www.jmock.org/) 11*5ca8c28cSEnji Cooper* [EasyMock](https://easymock.org/) 12*5ca8c28cSEnji Cooper* [Hamcrest](https://code.google.com/p/hamcrest/) 13b89a7cc2SEnji Cooper 1428f6c2f2SEnji CooperIt is designed with C++'s specifics in mind. 15b89a7cc2SEnji Cooper 1628f6c2f2SEnji CoopergMock: 17b89a7cc2SEnji Cooper 1828f6c2f2SEnji Cooper- Provides a declarative syntax for defining mocks. 1928f6c2f2SEnji Cooper- Can define partial (hybrid) mocks, which are a cross of real and mock 2028f6c2f2SEnji Cooper objects. 2128f6c2f2SEnji Cooper- Handles functions of arbitrary types and overloaded functions. 2228f6c2f2SEnji Cooper- Comes with a rich set of matchers for validating function arguments. 2328f6c2f2SEnji Cooper- Uses an intuitive syntax for controlling the behavior of a mock. 2428f6c2f2SEnji Cooper- Does automatic verification of expectations (no record-and-replay needed). 2528f6c2f2SEnji Cooper- Allows arbitrary (partial) ordering constraints on function calls to be 2628f6c2f2SEnji Cooper expressed. 2728f6c2f2SEnji Cooper- Lets a user extend it by defining new matchers and actions. 2828f6c2f2SEnji Cooper- Does not use exceptions. 2928f6c2f2SEnji Cooper- Is easy to learn and use. 30b89a7cc2SEnji Cooper 3128f6c2f2SEnji CooperDetails and examples can be found here: 32b89a7cc2SEnji Cooper 3328f6c2f2SEnji Cooper* [gMock for Dummies](https://google.github.io/googletest/gmock_for_dummies.html) 3428f6c2f2SEnji Cooper* [Legacy gMock FAQ](https://google.github.io/googletest/gmock_faq.html) 3528f6c2f2SEnji Cooper* [gMock Cookbook](https://google.github.io/googletest/gmock_cook_book.html) 3628f6c2f2SEnji Cooper* [gMock Cheat Sheet](https://google.github.io/googletest/gmock_cheat_sheet.html) 37b89a7cc2SEnji Cooper 3828f6c2f2SEnji CooperGoogleMock is a part of 39*5ca8c28cSEnji Cooper[GoogleTest C++ testing framework](https://github.com/google/googletest/) and a 4028f6c2f2SEnji Coopersubject to the same requirements. 41