Q:

Reliable mocking framework for ActionScript?

I'm looking for a reliable mocking framework for ActionScript. I've been using mock-as3, but I'm annoyed with what I feel is a hack-ish solution for triggering events. There are other a few other reasons why I'd like to have some options, but not sure if I necessarily need to go into them. I've also looked into Mock4AS, but the interface appears to be cumbersome. Any finds will be appreciated, thanks.

A:

asmock is a dynamic mocking framework and supports triggering events as a response to a method being called. Despite still having the "beta" monikor, it has been used on several production applications (including inside a continuous integration server).
You would use it for your purpose like so:
var mock : ISometInterface = ISometInterface(mockFactory.createStrict(ISometInterface));
SetupResult.forEventDispatcher(mock); // stubs the IEventDispatcher methods
SetupResult.forCall(mock.someMethod())
           .dispatchEvent(new Event()); // dispatch an event when someMethod is called
mockFactory.replayAll();

mock.someMethod(); // will dispatch the event

If you have any issues working with asmock (or want to do something in particular), just shoot me a mail via sourceforge or put up a bug request.
A new project, based on the dynamic bytecode generation I did for asmock, has popped up called mockito (a port from the java framework).

A:

no, there is not really any such thing (that i know of) ... mock-as3 is the best you can get, in my opinion ... there is an open issue on adobe jira, that will hopefully be addressed some day, that would solve a lot of problems ... enabling proper mocking would be just one advantage ...
greetz
back2dos

