Re: Fundamental question: How to resolve dependencies with mock objects
- Subject: Re: Fundamental question: How to resolve dependencies with mock objects
- From: Andreas Schneider <asn@xxxxxxxxxxxxxx>
- Date: Tue, 27 May 2014 22:47:23 +0200
- To: cmocka@xxxxxxxxxxxxxx
On Tuesday 27 May 2014 15:02:21 James Grenning wrote:
> Maybe we are not talking about the same chapter. My fault.
> cmocka lives with all the limitations of C when trying to bind a
> test-double. Options are link-time binding, function pointers or
> preprocessor substitution. I barely discussed preprocessor substitution
> in the book, but I have numerous articles on my blog.
cmocka implements several function which help you to do mocking. It leaves the
way open how you do it.
> cmocka is just C code. So it has no monopoly on being the one way to do
> mocking in C. IMO cmocka's advantage is it is small and written only in
> C. C-only has benefits and limitations too, which I discuss in the
See also the mission statement ;)
> cmocka also does a few things in an odd way. For example, setup
> and teardown are not like setup and teardown in other xunit frameworks.
> I forget the details, but remember being surprised.
setup and teardown are treated the same way as a test.
Andreas Schneider GPG-ID: CC014E3D