What is the difference between gtest and gmock?

前端 未结 4 1271
孤城傲影
孤城傲影 2021-02-03 19:46

I\'m trying to understand the purpose of google-mock, Google\'s C++ mocking framework.

I have already worked with gtest earlier, but still I ca

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-03 20:16

    "Google Mock is not a testing framework itself. Instead, it needs a testing framework for writing tests. Google Mock works seamlessly with Google Test. It comes with a copy of Google Test bundled. Starting with version 1.1.0, you can also use it with any C++ testing framework of your choice. " - Google Mock, System Requirements

    Mock are like objects, defined in such a way to mimick the real-deal by supplying controlled behavior. For instance, to test a stock tick application, you'd create a fake stock data provider that created fake stock quotes to test your code with. Think of the word mock, literally means 'to mimic'.

提交回复
热议问题