[Test] Where to learn about boost::itest::mock_object?
Hi, I'm looking for a simple mocking library to use together with Boost.Test. There is Turtle (aka Boost.Mock) and googlemock. During retrospection of the big thread on Boost.Test future [1], I found this curious post by Gennadiy [2] about mock_object. I had no idea such facility lives in Boost.Test and it looks it's been there for very long time. I can't find any documentation about mock_oboject, only a couple of examples. So, I have a few questions: Is the mock_object an internal feature or is it dedicated (and ready) to use by Boost.Test users? What are basic features of this mocking facility? How does it compare to Turtle or googlemock? [1] http://thread.gmane.org/gmane.comp.lib.boost.devel/234297 [2] http://thread.gmane.org/gmane.comp.lib.boost.devel/234297/focus=234621 [3] find /home/mloskot/dev/boost/_svn/trunk/libs/test -type f | xargs grep mock_object Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
During retrospection of the big thread on Boost.Test future [1],
Holy crap! How can they talk about killing a library *only* on the developer's list? This would affect *tons* of people, including myself, since I regularly advocate Boost.Test for doing TDD in C++. This seems really unlike what I have come to consider from the Boost folks.
I found this curious post by Gennadiy [2] about mock_object. I had no idea such facility lives in Boost.Test and it looks it's been there for very long time.
Unfortunately I would not recommend it because it is basically undocumented. I would instead recommend using another mock object library in conjunction with Boost.Test such as googlemock or Turtle.
Is the mock_object an internal feature or is it dedicated (and ready) to use by Boost.Test users?
My opinion: no
What are basic features of this mocking facility?
My opinion: who knows, since it's not documented.
How does it compare to Turtle or googlemock?
My opinion: who knows, since it's not documented. -- "The Direct3D Graphics Pipeline" free book http://tinyurl.com/d3d-pipeline The Computer Graphics Museum http://computergraphicsmuseum.org The Terminals Wiki http://terminals.classiccmp.org Legalize Adulthood! (my blog) http://legalizeadulthood.wordpress.com
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
[...] I would instead recommend using another mock object library in conjunction with Boost.Test such as googlemock or Turtle.
I have since looked into this and I would recommend Turtle. http://turtle.sourceforge.net It has a simple, clean and easy syntax with very little boilerplate that you need to write in order to "callables" (objects providing an implementation of operator(), function pointers, std::function, etc.), mock interfaces and template arguments. (The author and I are discussing ways to make mocking template arguments, also known as Concepts, easier.) Unfortunately googlemock now requires the use of googletest as a link dependency. When I tried MockCpp, it required too much repetitive boiler plate for my tastes. -- "The Direct3D Graphics Pipeline" free book http://tinyurl.com/d3d-pipeline The Computer Graphics Museum http://computergraphicsmuseum.org The Terminals Wiki http://terminals.classiccmp.org Legalize Adulthood! (my blog) http://legalizeadulthood.wordpress.com
Mateusz Loskot
Hi,
I'm looking for a simple mocking library to use together with Boost.Test. There is Turtle (aka Boost.Mock) and googlemock.
During retrospection of the big thread on Boost.Test future [1], I found this curious post by Gennadiy [2] about mock_object. I had no idea such facility lives in Boost.Test and it looks it's been there for very long time.
You right. I never got to document this component. This was my attempt on implementing mock support in boost.test. In my opinion (obviously biased) it is still might be better than anything else I've seen in other places. That said, I will need to decide what to do about this. Either finish it and make it in full features mocking library or just adopt something else for the same purpose. Regards, Gennadiy
On 13 January 2014 11:32, Gennadiy Rozental
Mateusz Loskot
writes: I'm looking for a simple mocking library to use together with Boost.Test. There is Turtle (aka Boost.Mock) and googlemock.
During retrospection of the big thread on Boost.Test future [1], I found this curious post by Gennadiy [2] about mock_object. I had no idea such facility lives in Boost.Test and it looks it's been there for very long time.
You right. I never got to document this component. This was my attempt on implementing mock support in boost.test. In my opinion (obviously biased) it is still might be better than anything else I've seen in other places. That said, I will need to decide what to do about this. Either finish it and make it in full features mocking library or just adopt something else for the same purpose.
Gennadiy, Thanks for your answer. I think such facility would be useful. Best regards, -- Mateusz Łoskot, http://mateusz.loskot.net
participants (4)
-
Gennadiy Rozental
-
legalize+jeeves@mail.xmission.com
-
Mateusz Loskot
-
Mateusz Łoskot