TestingReview/Google? Test and Google Mock

General Comparison

Google Test is unit testing framework conforming to xUnit architecture. Google Mock is a library that can be used to provide mocking functionality to Google Test and other C++ testing frameworks as well. They can be used in combination for host based testing.

  • By defining a strict test format, Google Test supports automatic test discovery.
  • Google Test distinguishes fatal and non-fatal failures, which is not provided by most test frameworks.
  • Google Test provides a rich set of assertions, and even user-defined assertions for more readable tests results display. It has provided three flexible ways for user to define custom assertions, using existing boolean functions, use AssertionResult? object, and using Predicate-formatter to further customize error messages.
  • Google Test provides a mechanism to verify that unit tests fails or exit with right exit code or error message.
  • Google Test supports parameterized tests, which can be very convenient in tests automation.
  • Test error propagation options have made it possible to write complicated unit tests with subroutines. In detail, this option has made it possible to avoid memory corruption due to subroutine error and thus to avoid causing the other tests which have called the subroutine to go unexpected.
  • It also supports various options for running the tests,for example, tests repetition, independent tests running, tests shuffling.
  • It supports XML test report generation.
  • Google Mock provides a flexible mocking interface to Google Test and other C++ frameworks.
  • Google Mock supports overloaded function mocking, which is not supported by CMock.
  • Google Mock supports partial mocks.

Host-based Test Result

"This is the test output of the sample application of Google Test and Google Mock"

File: Google Mock.png?

It is very neat and easy to parse.

Last modified on Jul 8, 2012 at 10:39:15 PM Last modified on Jul 8, 2012, 10:39:15 PM