Chapter 10. Testing your Robotlegs application
We test the framework—so you don’t have to
The Robotlegs creators are test nuts. This means that the core
framework—the Injector
, EventMap
, CommandMap
, MediatorMap
and all the MVCS classes that you
extend are well covered with tests, so you don’t need to test their
functionality in your own tests.
Of course, the tests aren’t perfect—from time to time someone reports a strange behavior they’ve encountered and we realize that their particular corner-case isn’t covered by the tests. So we add more tests, fix the strangeness, ensure all the existing tests still pass and then push the update.
One of the main motivators for the creation of Robotlegs was to allow us to build our own applications using TDD (Test Driven Development). In contrast to some other frameworks, choosing Robotlegs makes it easier for you to implement unit, integration and end-to-end tests. When it comes to testing your own code, you should find that it’s simply a case of implementing some setup.
Your test provides the injections
Including the event dispatcher
If you’re testing a class that is normally instantiated with the injector, you need your test setup to do the work the injector would do.
If your class under test extends Actor
, Mediator
or Command
then the minimum you’ll need to
provide in the test setup is the eventDispatcher
.
override protected ...
Get ActionScript Developer's Guide to Robotlegs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.