I've been getting into some Flex 3 lately and have been loving both PureMVC Standard and MultiCore. Without PureMVC, my Flex and Flash code would be (and is) a total mess. So amazing job, PureMVC team. I'd be lost without you.
Recently I picked up a copy of the Flex 3 Cookbook
and was drawn into the chapter on FlexUnit
. I played with some of the samples and immediately tried to apply it to the PureMVC Flex project I was working on. All was well until I tried to write some simple unit tests for various asynchronous web service methods in a Proxy. The FlexUnit way of dealing with asynchronous interactions is to use their addAsync()
factory method when attaching to an EventDispatcher with addEventListener(). Since PureMVC doesn't throw events (at least not to my knowledge -- it may behind the scenes), I had to hack something together.
And so the PureMVC FlexUnit Testing
project was born.
I made a detailed write-up
for those interested laying out how it works and my thought process. I did some research before going down this road but couldn't find anyone with a similar solution. Maybe I'm blind or maybe I just wasn't asking the right questions.
I'd love to get some feedback from the PureMVC community. Is this an acceptable way to go about unit testing asynchronous Notifications or is there something completely obvious I'm missing?