First release

Tagged: parrots .net c# unit testing

Today I did the first upload to BitBucket of Parrots, a "record and replay" mocking library I'm working on since a few weeks.

Parrots introduces a (possibly) new concept about "record and replay" mocking for unit testing. It is written in C# and it is intended to be used in C#. It is in a very early stage, but there are already a few things the library can do. You can find out more about it browsing the code and trying the unit tests contained in the solution.

Some background: let's suppose I cannot do TDD, for whatever reason, and for whatever reason I end up writing "unit tests" but using "true" dependencies for my "system under test" (SUT). I know that these are not unit tests, but I still need them during development. So, should I at some point "convert" them "mocking" the concrete dependencies with a good mocking library like Rhino Mocks? Yes, but again, I have no time and, honestly, many times doing mocks is a quite long, tedious, complex and error prone activity, even more if I do no really care about mocks. I just would like to have "stubs", forget about them and have my tests go green...

So, the idea is: I go on writing "integration tests", which talks to concrete dependencies, but later at some point I tell my tests, through Parrots, to "record" the conversations happening between SUT and its dependencies. As soon as I do it, the tests convert themselves to use the recordings Parrots did for me, and since then they will stop talking to concrete implementations and switch to the "imitations" Parrots did for me. Now you know why this curious name... :)

You can read more about Parrots on the project home page.

1 Comment

  • spartaco said

    It sounds nice. Anyway I have some doubts, one for all, the dependencies must be deterministic, this is not always the case.

Add a Comment