Hello, I initially sent the following message to the boost-dev mailing list, but I'm thinking this might reach more potential users here on boost-users. Would a library for mock objects be of interest ? The documentation can be found here : http://mat007.users.sourceforge.net/boost_mock/ An archive is also available for download there : http://sourceforge.net/projects/mat007.u/files/boost-mock.zip It's been converted from turtle (http://turtle.sourceforge.net/) which was mentioned on the mailing-lists a couple of times in the past. There is a catch in that it needs Boost.Test from the release branch and doesn't compile with the trunk. The changes are minimal though and I can provide a patch if anyone is interested. Is anyone already using the library who would like to see it in Boost ? Or is anyone using another mock object library who wants to give it a go ? Or even better has anyone tried it and decided to user another library who would like to comment on it ? I would be highly interested in any feedback ! Thank you, MAT.
Really good work. I like the interface and the boost unit test integration.
I don't have time to test it now, but i defenitly would love to see it in
boost.
2013/9/20 Mathieu Champlon
Hello,
I initially sent the following message to the boost-dev mailing list, but I'm thinking this might reach more potential users here on boost-users.
Would a library for mock objects be of interest ?
The documentation can be found here : http://mat007.users.** sourceforge.net/boost_mock/http://mat007.users.sourceforge.net/boost_mock/ An archive is also available for download there : http://sourceforge.net/* *projects/mat007.u/files/boost-**mock.ziphttp://sourceforge.net/projects/mat007.u/files/boost-mock.zip It's been converted from turtle (http://turtle.sourceforge.**net/http://turtle.sourceforge.net/) which was mentioned on the mailing-lists a couple of times in the past.
There is a catch in that it needs Boost.Test from the release branch and doesn't compile with the trunk. The changes are minimal though and I can provide a patch if anyone is interested.
Is anyone already using the library who would like to see it in Boost ? Or is anyone using another mock object library who wants to give it a go ? Or even better has anyone tried it and decided to user another library who would like to comment on it ?
I would be highly interested in any feedback !
Thank you, MAT. ______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**usershttp://lists.boost.org/mailman/listinfo.cgi/boost-users
Mathieu Champlon
Hello,
I initially sent the following message to the boost-dev mailing list, but I'm thinking this might reach more potential users here on boost-users.
Would a library for mock objects be of interest ?
Hi Mathieu, Can you please summary here in few paragraphs: * What exactly you want to test? * What exactly you want to mock? * How do you want to record your expectations? * How do you want to test against these expectations? * Can you show some concise example if using this library? What do I start with? How do I write a test case? Regards, Gennadiy
Hello,
It could be of interest, but there is already google-mock out there, and it
is a good tool, I see no reason why to have another mock library.
On Jan 13, 2014 5:25 AM, "Gennadiy Rozental"
Mathieu Champlon
writes: Hello,
I initially sent the following message to the boost-dev mailing list, but I'm thinking this might reach more potential users here on
boost-users.
Would a library for mock objects be of interest ?
Hi Mathieu,
Can you please summary here in few paragraphs:
* What exactly you want to test? * What exactly you want to mock? * How do you want to record your expectations? * How do you want to test against these expectations? * Can you show some concise example if using this library? What do I start with? How do I write a test case?
Regards, Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
It could be of interest, but there is already google-mock out there, and it is a good tool, I see no reason why to have another mock library.
While older versions of google mock could be used independent of google test, it seems that the current versions of google mock have a link dependency on google test. I don't want to link in google test just to use google mock. Have you tried using current versions of google mock without using google test? -- "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
I didn't check if google.mock could be used separately from google.test.
In fact, I am very comfortable with using both of them together.
On Jan 20, 2014 6:42 AM, "Richard"
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
thusly: It could be of interest, but there is already google-mock out there, and it is a good tool, I see no reason why to have another mock library.
While older versions of google mock could be used independent of google test, it seems that the current versions of google mock have a link dependency on google test. I don't want to link in google test just to use google mock.
Have you tried using current versions of google mock without using google test? -- "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
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Gennadiy, On 13/01/2014 04:25, Gennadiy Rozental wrote:
Hi Mathieu,
Can you please summary here in few paragraphs:
* What exactly you want to test?
It's probably up to the user to decide what needs to be tested. Any piece of code (sub-system) which interacts with another (the rest of the system) can be tested, with a few restrictions. For instance the library won't be able to inject a different function implementation without some kind of hook (e.g. a function pointer passed to the code under test).
* What exactly you want to mock?
Classes, concepts, functions and function objects are supported, see http://mat007.users.sourceforge.net/boost_mock/boost_mock/reference.html#boo...
* How do you want to record your expectations? * How do you want to test against these expectations? * Can you show some concise example if using this library? What do I start with? How do I write a test case?
Does the motivation example from the introduction answer your questions ? http://mat007.users.sourceforge.net/boost_mock/boost_mock/motivation.html I'll copy it here if you want to discuss it: class view { public: virtual void display( int result ) = 0; }; class calculator { public: calculator( view& v ); void add( int a, int b ); // the result will be sent to the view 'v' }; BOOST_MOCK_BASE_CLASS( mock_view, view ) // declare a 'mock_view' class implementing 'view' { BOOST_MOCK_METHOD( display, 1 ) // implement the 'display' method from 'view' (taking 1 argument) }; BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) { mock_view v; calculator c( v ); BOOST_MOCK_EXPECT( v.display ).once().with( 0 ); // expect the 'display' method to be called once (and only once) with a parameter value equal to 0 c.add( 0, 0 ); } Cheers, MAT.
On 14 January 2014 05:52, Mathieu Champlon
Does the motivation example from the introduction answer your questions ? http://mat007.users.sourceforge.net/boost_mock/boost_mock/motivation.html
I'll copy it here if you want to discuss it:
class view { public: virtual void display( int result ) = 0; };
class calculator { public: calculator( view& v );
void add( int a, int b ); // the result will be sent to the view 'v' };
If I was developing a mocking framework, I'd rely on some classic Unit Testing/Mocking examples to support the motivation, like those about logging or sending e-mail. Simply, I'd translate Roy Osherove's introductory examples: http://www.youtube.com/watch?v=fAb_OnooCsQ Those are so well known within testing community, they are almost idiomatic, hence best for selling a framework. Best regards, -- Mateusz Łoskot, http://mateusz.loskot.net
On 14/01/2014 10:43, Mateusz Łoskot wrote:
If I was developing a mocking framework, I'd rely on some classic Unit Testing/Mocking examples to support the motivation, like those about logging or sending e-mail. Simply, I'd translate Roy Osherove's introductory examples: http://www.youtube.com/watch?v=fAb_OnooCsQ
Those are so well known within testing community, they are almost idiomatic, hence best for selling a framework.
Best regards,
Hi, Thanks for the link. You're right that a real world use case is likely to be a better example. I'll try and rework the motivation/introduction page. Thank you! Regards, MAT.
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
If I was developing a mocking framework, I'd rely on some classic Unit Testing/Mocking examples to support the motivation, like those about logging or sending e-mail. Simply, I'd translate Roy Osherove's introductory examples: http://www.youtube.com/watch?v=fAb_OnooCsQ
Those are so well known within testing community, they are almost idiomatic, hence best for selling a framework.
If I had known about Turtle when I was writing my tutorials, I would have used it instead of a hand-written fake when talking about creating UI dialogs with TDD: http://legalizeadulthood.wordpress.com/2009/07/05/c-unit-tests-with-boost-te... I think it would have made things a little easier to explain and certainly save work in that you don't have to make the test doubles by writing lots of boiler plate code. I agree that this is the area where Turtle's documentation could use the most improvement -- real-world examples that get away from just showing the syntax and show the mocks being used in a meaningful way. -- "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
participants (6)
-
Daniel Krikun
-
ecyrbe
-
Gennadiy Rozental
-
legalize+jeeves@mail.xmission.com
-
Mateusz Łoskot
-
Mathieu Champlon