Overview of the Googletest Mocking (gMock) Framework
trunkgMock is a C++ framework for writing and using mock classes. It is designed to help improve system design and testing quality by providing a declarative syntax for defining mocks and controlling their behavior.
Key capabilities include:
- Declarative Mock Definition: Define mock objects using a specialized syntax.
- Partial (Hybrid) Mocks: Create objects that combine real implementation with mocked behavior.
- Complex Function Support: Handles arbitrary types and overloaded functions.
- Argument Validation: Includes a rich set of matchers to validate function arguments.
- Behavior Control: Uses intuitive syntax to specify how mocks should respond to calls.
- Automatic Verification: Automatically verifies expectations without requiring a manual record-and-replay cycle.
- Ordering Constraints: Allows expressing arbitrary (partial) ordering constraints on function calls.
- Extensibility: Users can define custom matchers and actions.
- Exception-free: The framework does not use C++ exceptions.
gMock is part of the GoogleTest C++ testing framework.