Delphi Mock Wizard
- by Todd
Let me preface this by saying I'm fairly new to Unit Testing, Mocks, Stubs, Etc...
I've installed Delphi-Mock-Wizard. When I select a unit and "Generate Mock", a new unit is created but it's very basic and not anything what I understand Mocks to be.
unit Unit1;
(** WARNING -
AUTO-GENERATED MOCK! Change this
unit if you want to, but be aware that
any changes you make will be lost if
you regenerate the mock object (for
instance, if the interface changes).
My advice is to create a descendent
class of your auto-generated mock - in
a different unit - and override
things there. That way you get to
keep them.
Also, the auto-generate
code is not yet smart enough to
generate stubs for inherited
interfaces. In that case, change your
mock declaration to inherit from a
mock implementation that implements
the missing interface. This,
unfortunately, is a violation of the
directive above. I'm working on it.
You may also need to manually change
the unit name, above. Another thing
I am working on.
**)
interface
uses
PascalMock,
TestInterfaces;
type
IThingy = interface;
implementation
end.
Looking at the source there seems to be quite a bit commented out. I'm wondering, has anyone gotten this to work?
My IDE is D2010.
Thanks.