Unit Testing Flex Application with Fluint (Flex Camp Boston 2008)
Unit Testing Flex Application with Fluint
Mike Nimer, Digital Primates (presented for Jeff Tapper who was unable to make it)
Testing is like source control. You don't know how much you need until you start using it.
Cold Fusion started out without much testing.
Ever bug has to have a unit test that exercises the bug before fixing it. Regression bugs discovered as part of testing are show stoppers.
Testing methods
Manual testing: humans create and run, low cost to start high cost to maintain, testing happens less often
Automated testing: humans create and computers run, higher cost to develop but lower to run, more often
Testing as part of development
Code until the red goes away
Developers create code and write tests, focus on test driven development
Automated build checkout, build, and test running, various tools to do that
Test types
Unit tests: individual method testing
integration tests: combination of test components
Tools for testing
FlexUnit: Original testing framework, based on JUnit
Flunit: Better asynchronous testing, better UI testing support, and sequences
Integartion testing is hard: Visual Flex Unit does bitmap comparison,
Fluint checks sequences and events
Test methods , test cases, test suites, and test runner. Various types of assertions. Comes with runner and has file watcher to pickup modules and run tests on change.
Asynchronous Testing
Events can occur at any time so you need to handle it sometime later. Uses asyncHandler which is a function that you pass as the event listener. Also want to pass data through to handler. Second argument to event handler. Can have asyncHandler as part of setup step.
UIComponent Testing
TestCase is a UIComponent so it can have components added to it as a child. Still need to what events to listen for.
Sequences
String together many sets and event waiting.
Test meta-data flag
Meta-data is copied over and available in the reports. Also produces XML like file in a JUnit like format.
Test filter and sorting
Only run certain tests, headless test runner
Configuring Fluint and test setup: Writing libraries can have another test application. Flex projects can't link so
Migrating from Flex Unit to Fluint? Best to ask on the forumns.
Mocking data? Nothing tied into Flinut, framework can support it.
Code coverage: using Flex Cover.
AIR test runner: looks for directory changes and runs it.
Comments
Posted by: David Colwell | April 17, 2009 2:53 PM