New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TStub that is simpler and doesn't do anything #13
Comments
I'm not sure a separate TStub is needed. As I understand it, the difference between a Stub and a Mock is that for Stubs you do not set expectations for it or verify that those expectations were met. So surely you can just use TMock and use just the behavior part? |
Vince - I'm working on my book, and the distinction that I'm drawing is that a stub It's hard to draw the distinction when you need to use TMock for both a It's hard to describe the difference between a stub and a mock when all you Nick On Sat, Sep 7, 2013 at 8:23 PM, Vincent Parrett notifications@github.comwrote:
|
BTW, Fowler's article makes my point: Mocks aren't stubs, and so we Nick On Sat, Sep 7, 2013 at 8:23 PM, Vincent Parrett notifications@github.comwrote:
|
I spent the last hour looking at this, simple enough to create a TStub that leaves out the expectation/verification part of the mock, but at the moment there is no code to deal with providing default return values.. so if you have not setup the stub method then it will raise an exception. If we can find an easy way to provide default return values then I guess we could remove the exception when the return type is simple (string, ordinal etc). Jason was also looking at auto mocking interface/object properties.. will discuss with him on Monday, not sure if he made any progress on this. |
Okay, cool -- Sounds interesting. Thanks for the consideration -- Nick On Sat, Sep 7, 2013 at 9:40 PM, Vincent Parrett notifications@github.comwrote:
|
I have just pushed a new branch, with TStub. I will merge it into master this week.. but need to first find a better way to get a default TValue for a TRttiType. At compile time, we can use Default(X), but there doesn't seem to be an equivelent runtime method. Usually the compiler magic functions are in System.pas so we could see how they work, but this one isn't. |
Hey Nick, found this very nice explanation of the differences between stubs and mocks : http://marknic.net/2010/01/11/mocks-vs-stubs/ sums it up quite nicely. |
closing, basic stub support merged in a while back. |
Current testing wisdom says that there are two kinds of fakes, Mocks and Stubs. It's probably too late to change this project's name to "Delphi Isolation Framework", but may I suggest that we add a TStub to the project?
TStub would stand in for any class or interface and basically do nothing but "be" the class or interface that it is designed for.
This would enable the framework to be clearer about the purpose of a given fake inside of a test.
Thoughts?
The text was updated successfully, but these errors were encountered: