C++ Mocks Made Easy - An Introduction to gMock

Posted in Conferences, Companies, Testing, Project Management, Development on March 20, 2009



Note: This project has been open-sourced under the name Google C++ Mocking Framework, and the project's homepage is http://code.google.com/p/googlemock/

Mock objects make unit testing easier and more effective. They cut code dependencies, make the tests fast and robust, make the test intent clear, and enable developers to easily test the interaction between components.

While an invaluable technique, mocks haven't caught on in the C++ land due to limitation of the language and lack of good tools.

gMock is a library that makes C++ mocks easy and practical. A user would describe the interface he wants to mock and gMock will automatically generate the implementation. Then the user can control the generated mock using an intuitive Domain-Specific Language (embedded in C++) that resembles English. Announced in Q4 2007, gMock has been used in over 100 projects at Google.

The primary designer of gMock will present:

What mock objects are and what they can do for you;
How gMock works;
How to use gMock to your benefit; and
Some technical challenges in developing gMock (crazy templates and macros come to mind).

If you want to write well-designed and well-tested C++ programs, this talk is for you.

Speaker: Zhanyong Wan
Zhanyong Wan is a software engineer in Google Kirkland. He is the primary author of Google Test and gMock, our in-house C++ testing infrastructures. His main interest is in writing tools to help fellow developers produce better code.

Google Tech Talks
January 22, 2008

Watch Video

Tags: Techtalks, Google, Conferences, Testing, TDD, engEDU, Education, Mocking, Google Tech Talks, C#, Companies