Hi everybody, I must admit, that I've been dealing with the same problem of choosing an appropriate mocking framework few months ago (I've settled with Turtle for now). It would be incredibly helpful to have this functionality in included in Boost, whether in Boost::test or in some now framework, e.g. Boost::mock. Maybe, it could be a good way to simply integrate some of the currently working frameworks, be it FakeIt or Turtle? By the way, Turtle is being maintained, at least to a degree of compatibility with the latest Boost version. Best regards, Martin On 09. 12. 18 13:01, Tom Kent via Boost-users wrote:
On Sun, Dec 9, 2018 at 5:04 AM Sean Farrow via Boost-users
mailto:boost-users@lists.boost.org> 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 it.
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.
Tom
[1] https://github.com/eranpeer/FakeIt [2] https://github.com/eranpeer/FakeIt/wiki/Quickstart [3] http://turtle.sourceforge.net/ [4] https://github.com/abseil/googletest/tree/master/googlemock [5] https://github.com/abseil/googletest [6] https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-ori...
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users