views:

85

answers:

2

I stumbled upon this open source project Fake It Easy, and I have to admit, it looks very interesting, however I have my doubts, what are the difference between FIE fakes and say Moq Mocks? Is any one better for particular uses?

EDIT:

What is it about this new framework that would make it better than say Moq?

+8  A: 

The terminology used in testing can be slightly confusing. The best source explaining the difference between different concepts is Mocks Aren't Stubs by Martin Fowler. In summary, fake is a generic term that describes both stubs and mocks.

Adam Byrtek
Lol any question with the mock or fake tag should pop up a "have you read Martin Fowler's article" pop up :P
Francisco Noriega
That link indeed has the best definitions for these terms
Pratik
Great article but man he could wor a little on formating, plain html that spans the whole screen's length, uncolored code... it really makes it hard to read
Francisco Noriega
+1 - Martin Fowler is god, plain and simple. I have learnt a ton from his website.
RPM1984
+1  A: 

The terminology in mocking can be confusing - and sometimes is quite unintuitive.

Therefore, many people proposed a simpler, new terminology, where you have only fakes, mocks, and stubs. Fake is the generic term for all possible kinds of test doubles, no matter where they come from and how they are used.
Beyond that, fakes are distinguished only along one single dimension: whether they influence test outcome or not; or, in other words: whether you have to set up return values for the fake, which are somehow used during test execution, or it is a 'silent' object which only serves to fulfill some dependency.
If it is such a 'silent' object, then it is called a Stub. If it actively participates in test execution, then it is called a Mock. Beyond that, there's no further distinction - which surely has its historical merits, but is now largely counter-intuitive and academical, and it's kind of obfuscating really important concepts of Test-driven development.

Concerning the comparison between Moq and FakeItEasy: the two frameworks are largely the same from a conceptual point of view - the differences are only in the API and in the terminology...

Thomas

Thomas Weller