courtneypresto / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Does GTest has a Mock class? #186

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I want to know does gtest has a Mock class?
Sometimes I do unittest, I need to mock some exceptional situation, for
example, memory overflow, lan disconnect and so on. Can gtest mock these
situations for me? 

If gtest has a mock class, how can I use it?

Original issue reported on code.google.com by magicsto...@gmail.com on 28 Aug 2009 at 2:46

GoogleCodeExporter commented 9 years ago
Please use the discussion group for questions.  You'll get answers faster that 
way.

See
http://code.google.com/p/googletest/wiki/GoogleTestFAQ#My_question_is_not_covere
d_in_your_FAQ!
for more info.

What you need is a mocking framework, e.g. Google Mock
http://code.google.com/p/googlemock 

Original comment by zhanyong...@gmail.com on 2 Sep 2009 at 4:34

GoogleCodeExporter commented 9 years ago
Thanks for your answer. I know GMock, but it's for JAVA

Original comment by magicsto...@gmail.com on 2 Sep 2009 at 7:05

GoogleCodeExporter commented 9 years ago
Sorry, there seems to be a misunderstanding. The googlemock framework is for 
C++. Quote from the 
homepage:
"Welcome to Google C++ Mocking Framework!

Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s specifics in 
mind, Google C++ Mocking 
Framework (or Google Mock for short) is a library for writing and using C++ 
mock classes."

Original comment by dirk....@gmail.com on 11 Sep 2009 at 8:04