I build and maintain a set of Flash components that is distributed to publishers and allows them to integrate with our system. Currently the component has no UI and simply contains compiled code for querying our system servers, parsing the response, and modifying the params sent in the query. There's an As2 version and AS3 versions for both Flex and CS3. Our typical workflow is like this:
1.) load the component 2.) set parameters on the component 3.) tell the component to query our system 4.) wait for an event saying the response has been received and parsed 5.) call methods on the component for retrieving and using parsed data
We've been talking a lot lately about automating the testing of these components, and there seems to be a lot of buzz around frameworks like AsUnit and FlexUnit. However, I've never been able to grasp how I might effectively use of one of these. The examples and tutorials always skimp on real-world examples and instead provide multiple classes and excessive code for testing whether an example function returns num1+num2.
The only thing I can guess is that these testing frameworks are intended to be implemented from the start, with planning for the test suite, test runner, and test cases built in at the start of development.
An automated test of our component would have to make sure properties were properly set, those properties were sent in the request to our system, the response received was correct considering the parameters sent, the parsed data includes correct information, and no errors, bad responses, or infinite parsing loops are caused.
my question is, is there any way to automate testing of an existing, widely distributed, established Flash component without completely reworking it to fit into a testing framework? Or am I misunderstanding the test frameworks and this is already possible?
UPDATE: Thanks for the responses. I have started to integrate my component with AsUnit and think I have a pretty good understanding of how it can help me. However, the AS2 AsUnit does not support asynchronous test cases, and I'm having a hard time finding an AS2 unit test framework that does. Asynchronous testing is REALLY important to this project. Does anyone have any recommendations for a different framework? Thanks!