You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.7 KiB

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