go/gmock
Googletest is Google's C++ testing and mocking framework. Please note that there are legacy names you may encounter “gUnit” and “gMock” - these names are now merged into “googletest”
“I‘m really enjoying trying it, and it’s amazing to me how far you‘ve taken this in C++. It’s changed the way I program (and therefore changed my life ;), and one of my teams has adopted it for all/most tests (and I'm working on the other).”
-- Derek Thomson, Google Mountain View
“I started using mocks with EasyMock in Java a few years ago and found them invaluable for making unit testing as painless and effective as possible. I‘m very glad (and amazed) to see you’ve managed to create something similar for C++. It's making the transition much more pleasant.”
-- David Harkness, Google Mountain View
“I #included
gmock.h
and lived to tell the tale... Kept me from having to depend onMockBigtable
thus far, which is huge.”
-- Matthew Simmons, Google NYC
“I like the approach of
EXPECT_CALL
much more than EasyMock‘s mock modes (record, replay). It’s the best way to ensure the user will never forget to verify the expectations: do it automatically!”
-- Tiago Silverira, Google Brazil
“It's by far the best mocking library for C++, by a long-shot.”
-- Joe Walnes, co-creator of jMock, Google London
Please see the googletest Users Guide for the combined gMock mocking documentation.
/google/src/head/depot/google3/third_party/googletest/googlemock/scripts/generator/gmock_gen.py *your.h ClassNames*
generates mocks for the given base classes (if no class name is given, all classes in the file are emitted).c-mock-dev
list (deprecated) - old archive, new archiveopensource-gmock
list - discussions on the development of gMock: subscribe, archive, smile!We'd like to thank the following people for their contribution to gMock: Piotr Kaminski, Jeffrey Yasskin (who/jyasskin), Joe Walnes, Bradford Cross, Keith Ray, Craig Silverstein, Matthew Simmons (who/simmonmt), Hal Burch (who/hburch), Russ Rufer, Rushabh Doshi (who/rdoshi), Gene Volovich (who/genev), Mike Bland, Neal Norwitz (who/nnorwitz), Mark Zuber, Vadim Berman (who/vadimb).