Search code examples
actionscript-3apache-flexflexunitflexunit4

FlexUnit: Can I unit test File Upload?


Can I use FlexUnit to unit test a File Upload and delete? Are those actions good examples of unit testing?

I'm a little new to unit testing and trying to figure out what parts of my UI are suitable for unit tests.

Thanks for any helpful tips.


Solution

  • The actual file operations will always be executed by native classes (such as FileReference), which you should not try to unit test - that's Adobe's responsibility, at least until Flex has left the Apache incubator.

    As a rule of thumb: Always unit test only the code you wrote yourself. You can decouple it by replacing all external dependencies with test doubles (i.e. stubs or mocks, for example using mockolate).