Reliable mocking framework for ActionScript?

I am looking for a reliable fake framework for ActionScript. I use mock-as3, but it annoys me what I consider a hack-ish solution for triggering events. There are several other reasons why I would like to have some options, but I'm not sure that I definitely need to go into them. I also learned Mock4AS, but the interface seems cumbersome. Any finds will be appreciated, thanks.

+3
source share
3 answers

no, actually there is no such thing (which I know about) ... mock-as3 is the best you can get, in my opinion ... there is an open problem on adobe jira , which I hope will be addressed in some that day that solves a lot of problems ... allowing the right mockery would be only one advantage ...

Greetz

back2dos

0
source

asmock is a dynamic rigging system and supports triggering events as a response to the called method. Despite the presence of a beta monitor, it was used in several production applications (including inside a continuous integration server).

You would use it for your purposes like this:

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

- asmock ( - ), sourceforge .

, -, asmock, mockito ( java ).

+6

, , Mock4AS . , . : record() . () , , Args() withArg(). assertTrue (mock.success());

, willReturn() willThrow().

, , deepCompare() / .

MockEventDispatcher. , : mock.dispatchEvent(someEvent);

.

.

-JP

-1
source

Source: https://habr.com/ru/post/1711843/


All Articles