<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Dec 9, 2018 at 5:04 AM Sean Farrow via Boost-users <<a href="mailto:boost-users@lists.boost.org">boost-users@lists.boost.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div lang="EN-GB"> <div class="gmail-m_-6686021816937853488WordSection1"> <p class="MsoNormal"><span lang="EN-US">Hi all,<u></u><u></u></span></p> <p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p> <p class="MsoNormal"><span lang="EN-US">I was just wondering whether boost.test provides any mocking facilities?<u></u><u></u></span></p> <p class="MsoNormal"><span lang="EN-US">If it doesn’t is there a recommended mocking framework?<u></u><u></u></span></p> <p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p> <p class="MsoNormal"><span lang="EN-US">Any help appreciated.<u></u><u></u></span></p> <p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p> <p class="MsoNormal"><span lang="EN-US">Kind regards<u></u><u></u></span></p> <p class="MsoNormal"><span lang="EN-US">Sean.</span></p></div></div></blockquote><div> </div><div><div>It doesn't.</div><div><br></div><div>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 <fakeit\single_header\boost\fakeit.hpp>`. <br></div><div><br></div><div>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.</div><div><br></div><div>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, </div><div><br></div><div>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.<br></div><div><br></div><div>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.</div><div><br></div><div>Tom<br></div><div><br></div><div>[1] <a href="https://github.com/eranpeer/FakeIt">https://github.com/eranpeer/FakeIt</a></div><div>[2] <a href="https://github.com/eranpeer/FakeIt/wiki/Quickstart">https://github.com/eranpeer/FakeIt/wiki/Quickstart</a><br></div><div>[3] <a href="http://turtle.sourceforge.net/">http://turtle.sourceforge.net/</a></div><div>[4] <a href="https://github.com/abseil/googletest/tree/master/googlemock">https://github.com/abseil/googletest/tree/master/googlemock</a></div><div>[5] <a href="https://github.com/abseil/googletest">https://github.com/abseil/googletest</a><br>[6] <a href="https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design">https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design</a></div> </div></div></div>