Boost logo

Boost Users :

Subject: Re: [Boost-users] Mocking with boost.test
From: Tom Kent (lists_at_[hidden])
Date: 2018-12-09 12:01:32

On Sun, Dec 9, 2018 at 5:04 AM Sean Farrow via Boost-users <
boost-users_at_[hidden]> wrote:

> Hi all,
> I was just wondering whether boost.test provides any mocking facilities?
> If it doesn’t is there a recommended mocking framework?
> Any help appreciated.
> Kind regards
> Sean.

It doesn't.

I've been using, and very much enjoying fakeit[1]. Its developer(s) have
taken boost::test into consideration and have a header you can include that
specifically integrates with boost, `#include

It has decent but not amazing documentation [2]. It has a pretty good
community that interacts through github issues/pull requests, but I haven't
found much outside that (blogs, reddit, etc), but that might be because I
haven't looked that hard. It is a bit difficult to google for.

I've also tried turtle [3], which is a mocking framework made specifically
for boost::test, but I remember being dissapointed in it, It was a while
ago, so I don't exactly remember why, I think it was lacking some fetures I
was looking for? It also doesn't seem to be maintained anymore,

Finally, I'd be remiss if I didn't mention Google Mock [4]. It isn't made
for use with Boost, it is specifically made for use with Google Test [5],
but it should be usable. I haven't tried it, but you may want to consider

In general, compared to a language like python, mocking is very difficult
to do in C++. It only works for virtual members, so if your codebase isn't
interface driven it won't work well. Wanting to use mocking well has made
us start using the SOLID [6] principles, which has been a great improvement
to the overall quality of our codebase.



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at