<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>(w)asp.net - parrots</title><link>http://www.robychechi.it:80/roby/Tags/parrots</link><description>(w)asp.net - parrots</description><item><title>Parrots on CodeProject</title><link>http://www.robychechi.it:80/roby/parrots/parrots-on-codeproject</link><description>&lt;p&gt;A few days ago I published an article about &lt;strong&gt;Parrots&lt;/strong&gt; on CodeProject. It can be found &lt;a target="_blank" title="Parrots on Codeproject" href="http://www.codeproject.com/KB/testing/Parrots.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Sat, 03 Sep 2011 20:23:28 GMT</pubDate><guid isPermaLink="true">http://www.robychechi.it:80/roby/parrots/parrots-on-codeproject</guid></item><item><title>Background and concepts</title><link>http://www.robychechi.it:80/roby/parrots/background-and-concepts</link><description>&lt;p&gt;The more I work on &lt;strong&gt;Parrots&lt;/strong&gt; and the ideas I have about it, the more I manage to give it a narrow and precise context. This is an important step, because it helps users to decide if and when they should use &lt;strong&gt;Parrots&lt;/strong&gt; instead of any other mocking library around.&lt;/p&gt;
&lt;p&gt;IMHO, and given my experiences in the last years, I think that classic mocking works perfectly when you do "true TDD", but maybe you do not do TDD, for many reasons:&lt;/p&gt;
&lt;p&gt;- you don't like it&lt;/p&gt;
&lt;p&gt;- you like it, but developers around you do not&lt;/p&gt;
&lt;p&gt;- you and developers like it, but your managers or company think it is a waste of time (sigh)&lt;/p&gt;
&lt;p&gt;- you and everyone at your company like it, but then you don't manage to setup a true test driven development process, which indeed is not so easy to build and mantain&lt;/p&gt;
&lt;p&gt;- ...&lt;/p&gt;
&lt;p&gt;For whatever reason you don't do it, you end up working in a different way, and probably you keep on doing "unit tests" which supply concrete dependencies to your SUTs. They are not unit tests, they are more "integration tests", but they are done during development, and not after. They are not a good thing, we all know it, but there are times when they are the most and the best we can do. It happened to me to work in such a situation, and the only remedy we found to fix this wrong (and quite useless) context was to transform those integration test in unit tests introducing mocking "a posteriori", but often you have to sacrifice code coverage for the same reasons you did not introduce TDD from the beginning. And you really feel you are doing something wrong...&lt;/p&gt;
&lt;p&gt;Now the idea is: you cannot do TDD, and you have to work with concrete dependencies, it would be great if "someone" would be able to transform our true dependencies in mock ones automatically, wouldn't it? That's where &lt;strong&gt;Parrots&lt;/strong&gt; enters.&lt;/p&gt;
&lt;p&gt;I already talked about this, but now what I want to concentrate on the mindset shift we have here. With classic mocking, you have to fully describe the behavior of your dependencies, because you may not have them yet, so you need a very good library to do it, and in "real world" scenarios your mocks are quite hard to setup. You must concentrate on &lt;strong&gt;what depencencies have to do&lt;/strong&gt; and replicate it with enough precision to "fool" your SUT and make tests go green. With &lt;strong&gt;Parrots&lt;/strong&gt; the mindset is different: you have the dependencies already, and you just want to remove them at a later time, so what you need is just a way to "record" conversations between SUT and dependencies, and to simulate them at a later time mantaining true fidelity with the real conversations. You must concentrate on recording call sequences with "high fidelity", and then on &lt;strong&gt;how two call sequences must be considered equivalent&lt;/strong&gt;. This might not be an easy task, but it seems to me much more generic, because you don't have to deal with defining each call's behavior, but only with instructing someone (&lt;strong&gt;Parrots&lt;/strong&gt;) about how it can distinguish call sequences, without having to deal with every single sequence. It seems to me much more 'declarative', don't you think?&lt;/p&gt;
&lt;p&gt;Ok, &lt;strong&gt;Parrots&lt;/strong&gt; is trying to follow this path, and I'm working on it day by day to implement this vision in a consistent way. I already cover several cases although not all of them yet, but I'm doing my best and I don't think it will get too much time.&lt;/p&gt;
&lt;p&gt;I will talk more about details soon. Stay tuned :)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;</description><pubDate>Sun, 14 Aug 2011 16:56:27 GMT</pubDate><guid isPermaLink="true">http://www.robychechi.it:80/roby/parrots/background-and-concepts</guid></item><item><title>Why Parrots</title><link>http://www.robychechi.it:80/roby/parrots/why-parrots</link><description>&lt;p&gt;&lt;a target="_blank" title="Parrots" href="http://www.robychechi.it/roby/parrots/first-release"&gt;&lt;strong&gt;Parrots&lt;/strong&gt;&lt;/a&gt; is my first open-source project ever, for many reasons I never joined one before and it is the first I decided to start, but I've always been attracted by the idea of having a good idea and share it, eventually getting to form a good distributed team of developers collaborating on it.&lt;/p&gt;
&lt;p&gt;Of course I'm still very far from getting anywhere, and I really don't know if I ever will, but I already feel happy about my decision for many reasons which I'm discovering day by day:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- it is &lt;strong&gt;challenging&lt;/strong&gt;: I feel some sort of responsibility, I'm writing code that very good developers out there might see, inspect, dissect, criticize, demolish...&amp;nbsp; I have to try my best in order to build something decent and useful.&lt;/p&gt;
&lt;p&gt;- it is &lt;strong&gt;instructive&lt;/strong&gt;: the more I add features or fix bugs in &lt;strong&gt;Parrots&lt;/strong&gt;, the more I learn things, and the more I &lt;em&gt;have to&lt;/em&gt; learn things, because &lt;strong&gt;Parrots&lt;/strong&gt; belongs to a quite extensive area: code testing; it requires quite good knowledge about the .NET Framework, and being &lt;strong&gt;Parrots&lt;/strong&gt; itself a small framework, it must be written following best practices and &lt;a target="_blank" title="Framework Desing Guidelines" href="http://www.amazon.com/Framework-Design-Guidelines-Conventions-Libraries/dp/0321545613/ref=ntt_at_ep_dpt_1"&gt;design guidelines&lt;/a&gt;. I really love to learn about programming and about .NET and C#, and this project is the best way to get in touch with lots of deep and interesting details.&lt;/p&gt;
&lt;p&gt;- it is &lt;strong&gt;involving&lt;/strong&gt;: I'm writing code that nobody asked me for and that nobody will ever pay me for... and it's great! So far I decide the features by myself, I work on it at my preferred pace, I play both the "customer" and the "developer" roles, trying to be very demanding towards myself concerning requirements and code quality...&amp;nbsp; Exciting :)&lt;/p&gt;
&lt;p&gt;- it is (or might be) &lt;strong&gt;useful&lt;/strong&gt;: many times I felt that something was missing in "mocking area" (the last time I felt this way: today...), "mocks" and its variants are great tools which help us to isolate our "system under test" from other possibly failing components, but "mocks" are not always easy to do, because mocking libraries may have a steep learning curve, and most of all because doing "mocks" can be a quite long and tedious job. If you have to add features over a quite big existing code base, it is quite common that your components have to interact with existing and complex ones in many different ways, and this implies mocking lots of components, lots of calls towards them, and many permutations of parameters and results on those calls. Even if mocking libraries allow us to setup calls with "don't care" rules, it is still very likely that you have to setup dozens of mocks, and for each one of them dozens of calls. If &lt;strong&gt;Parrots&lt;/strong&gt; would ever get to the point I hope it will, a lot of this plumbing code will disappear or will be automatically generated.&lt;/p&gt;
&lt;p&gt;- all this is &lt;strong&gt;vitalizing&lt;/strong&gt;: I have had a couple of difficult years about my job, when it was very hard to keep up the interest in programming... since a few months it's over, and Parrots is one more piece of this new phase of my &lt;a target="_blank" title="This Developer's Life" href="http://thisdeveloperslife.com/"&gt;developer life&lt;/a&gt; :)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It would be great to discover day by day that the idea is worth going on, that people likes it and that developers want to join me on it... :)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;</description><pubDate>Thu, 11 Aug 2011 22:37:53 GMT</pubDate><guid isPermaLink="true">http://www.robychechi.it:80/roby/parrots/why-parrots</guid></item><item><title>First release</title><link>http://www.robychechi.it:80/roby/parrots/first-release</link><description>&lt;p&gt;Today I did the first upload to BitBucket of &lt;a target="_blank" title="Parrots" href="https://bitbucket.org/wasp/parrots"&gt;Parrots&lt;/a&gt;, a "record and replay" mocking library I'm working on since a few weeks.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Parrots&lt;/strong&gt; 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.&lt;/p&gt;
&lt;p&gt;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 &lt;strong&gt;not&lt;/strong&gt; 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 &lt;a href="http://hibernatingrhinos.com/open-source/rhino-mocks"&gt;Rhino Mocks&lt;/a&gt;? 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...&lt;/p&gt;
&lt;p&gt;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 &lt;strong&gt;Parrots&lt;/strong&gt;, to "record" the conversations happening between SUT and its dependencies. As soon as I do it, the tests convert themselves to use the recordings &lt;strong&gt;Parrots&lt;/strong&gt; did for me, and since then they will stop talking to concrete implementations and switch to the "imitations" &lt;strong&gt;Parrots&lt;/strong&gt; did for me. Now you know why this curious name... :)&lt;/p&gt;
&lt;p&gt;You can read more about &lt;strong&gt;Parrots&lt;/strong&gt; on the project home page.&lt;/p&gt;</description><pubDate>Tue, 09 Aug 2011 22:41:39 GMT</pubDate><guid isPermaLink="true">http://www.robychechi.it:80/roby/parrots/first-release</guid></item></channel></rss>