Aidmock - safe mocking

Hi guys,

I launched some days ago a new project that aims to make the use of
mocks
safer.
This is the URL of project: https://github.com/wilkerlucio/aidmock

The basic idea is to make user define interfaces of classes, when user
defines the class interface (which is something like defining method
signatures on C or Java) Aidmock automatic generate some sanity check
specs, these specs will verify if class has the method defined, and if
it respect arity of interface.

And more important, when user create mocks while developing specs, it
will verify all defined mocks, and check if they are respecting
defined interface.

You can saw more about project motivation here(with some example of
why it exists): https://github.com/wilkerlucio/aidmock/wiki/Motivation

This project is a kind of experimental one, with a different idea, and
any feedback will be really welcome.

Thanks

Wilker Lúcio


Kajabi Consultant
+55 81 82556600

On Jan 16, 2011, at 5:52 PM, Wilker wrote:

it respect arity of interface.

And more important, when user create mocks while developing specs, it
will verify all defined mocks, and check if they are respecting
defined interface.

You can saw more about project motivation here(with some example of
why it exists): https://github.com/wilkerlucio/aidmock/wiki/Motivation

This project is a kind of experimental one, with a different idea, and
any feedback will be really welcome.

Hi Wilker,

There have been numerous requests for a tool that would warn when
mocking method that don’t exist, and I think it is great that you are
working on aidmock.

In the Motivation wiki page, you say that you recommend using real
objects instead of mocks in all cases. I don’t agree with this, as an
important basis for mock objects is the idea that we should mock roles,
not objects [1].

I imagine that aidmock could work equally well with real objects and
mock objects if there were a hook to tell a mock what interfaces it is
allowed to stub. Something like:

account = double(‘account’).constrained_to(MyInterface)

WDYT?

[1] http://static.mockobjects.com/files/mockrolesnotobjects.pdf

You are right Dave,

I was thinking about it, but with a different interface, like:

Aidmock.double(Interface)

but I mean your is cooler, and user will be able to apply mocks/stubs
directly

I will work on it today :slight_smile:

Thanks

Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600

Dave, I just updated the gem and documentation, now supporting
constrained_to on mocks :slight_smile:

You have any other suggestions for now?

Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600

David

Also, will be nice if in the future you and other mock frameworks
authors
support some kind of reflection on defined doubles (or even better, I
can
define an “Aidmock support guideline” to you implement support by
yourselves). If you take a look at current RSpec Mocks driver on
Aidmock[1]
you will see that I need to use a lot of “instance_variable_get” to
accomplish the work, and it has a serious risk to broke in any
rspec-mocks
update…

WDYT?

[1]
https://github.com/wilkerlucio/aidmock/blob/master/lib/aidmock/frameworks/rspec.rb

Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600

On Jan 18, 2011, at 2:03 PM, Wilker wrote:

David

Also, will be nice if in the future you and other mock frameworks authors
support some kind of reflection on defined doubles (or even better, I can define
an “Aidmock support guideline” to you implement support by yourselves). If you
take a look at current RSpec Mocks driver on Aidmock[1] you will see that I need
to use a lot of “instance_variable_get” to accomplish the work, and it has a
serious risk to broke in any rspec-mocks update…

WDYT?

I’d be willing to do that in the long run, but I’d want to see how
aidmock shapes up in terms of acceptance and usage first. The last thing
I want in rspec is a bunch of extra code that nobody is using.

Yeah, unfortunately I’m not receiving too much feedback about it for
now,
so, I’m just using for myself and trying to make it better. I will try
to
spread more and more the idea, so make more people wanna try it, its a
different concept and I mean people still a little afraid to try it. But
I
will keep going on it, I really believe in the idea :slight_smile:

Thanks

Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600

On Jan 18, 2011, at 4:30 PM, Wilker wrote:

Yeah, unfortunately I’m not receiving too much feedback about it for now, so,
I’m just using for myself and trying to make it better. I will try to spread more
and more the idea, so make more people wanna try it, its a different concept and I
mean people still a little afraid to try it. But I will keep going on it, I really
believe in the idea :slight_smile:

Wilker: not sure what you were expecting, but you just announced it on
this list 2 days ago :slight_smile: Give it a bit more time.

Everybody else: come on, people! Many of you have been asking for some
sort of auditing tool for mocks that tell you when you’re mocking stuff
that doesn’t exist, and Wilker here is finally offering a workable
solution. Feedback, please :slight_smile:

Cheers,
David

On Jan 18, 2011, at 2:30 PM, Wilker wrote:

Yeah, unfortunately I’m not receiving too much feedback about it for now, so,
I’m just using for myself and trying to make it better. I will try to spread more
and more the idea, so make more people wanna try it, its a different concept and I
mean people still a little afraid to try it. But I will keep going on it, I really
believe in the idea :slight_smile:

I’ll give it a good mess around. It looks great.

And like David said, please don’t be discouraged by the limited adoption
after two days :wink:

Pat

Hi Guys,

I added a significant release of Aidmock today.

Now it supports an Automatic Interfacing feature. With this feature you
can
use Aidmock without defining any interface at all, when Aidmock try to
check
an interface, and it doesn’t exists, Aidmock will automatic generate the
interface (of class, and all of it ancestors). It’s not much precise as
manual one (I can’t automatic detect return and argument types), but is
an
easy way to start, with minimum setup at all. It also can’t detect ghost
methods (methods implemented with method_missing).

What you guys think about this new feature?

Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600

Thanks guys,

When I said I’m not getting so much feedback, I was referring because
more
time ago I talked about it in a lot of other lists too, but I know it
still
a lot young, and need a lot of improvement too :slight_smile:

But you know, when we launch a new project we get a lot excited with it
and
expects more feedback as possible :slight_smile:

Any suggestions, critics, any kind of feedback will be really welcome :slight_smile:

Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600