[squid-dev] cppunit -> googletest / gmock?
Alex Rousskov
rousskov at measurement-factory.com
Sun May 31 19:43:46 UTC 2020
On 5/31/20 3:05 PM, Francesco Chemolli wrote:
> - https://stackoverflow.com/questions/7922289/googletest-vs-cppun
> it-the-facts
> - trivial but it builds up: not generally necessary to have .h and .cc
> for simple cases
> - comparison
> table: https://socialcompare.com/en/comparison/c-unit-testing-framework
> - gmock/gtest is used in broadly-used projects (e.g. chromium) - I'm not
> sure
> So far I'm basing on documentation, found
> at https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md .
> I see:
> - a more structured approach to mocking, and more infrastructure to do it
> - ON_CALL and EXPECT_CALL patterns to define actions and expectations on
> class methods (method called once / called multiple times). This can
> also allow to change the behaviour of a mocked object on different tests
> without having to remock it all
> - matchers on called methods
> - moched methods can different return values depending on arguments, and
> check for complex sequences of calls to methods (call a() with some
> arguments, then either b() or c(), if it's c() must be followe by d()
> - for object, the concept of "uninteresting calls" that get ignored, and
> can be defaulted
Thank you for summarizing this info!
FWIW, if you and Amos decide to switch to another unit test platform, I
will not object to such a switch, provided the transition is instant. We
do not have enough resources to properly write and maintain unit tests
using one platform IMO. We certainly do not have enough resources for
two platforms.
> TBH I favour unit tests as well.
TBH, I am against test discrimination ;-).
Alex.
More information about the squid-dev
mailing list