The first major update of the framework core has now been completed. This is the first of several phases to create a more sophisticated asynchronous testing platform.
There are a few key differences between Flash and more sophisticated runtime environments like .NET or Java. One such disparity is the single-threaded nature of the Flash Player. Flash does not have the ability to “stop” the main thread or spawn new threads while execution completes.
An obvious example of this threading limitation surrounds the rendering model. Because rendering is executed on the same thread as all other scripts, the UI cannot be invalidated and redrawn until the entire stack has been executed. Therefore, in order for the upcoming FUnit GUI to display real-time testing feedback, this requires a more creative deviation from the conventional “for” loop.
This update uses an internal testing scheduler that will delegate testing execution across multiple execution stacks (i.e. frames). At this stage, the scheduler merely executes one test per frame but because the class has been externalized, it can be easily enhanced. It is possible, for example, for the scheduler to execute as many tests as possible while still maintaining the same frame rate.
So what’s next for FUnit? Although there’s much more work to be done surrounding asynchronous testing, it’s finally time for a GUI.