This article is part of group of posts on Flex project setup or five use cases for multiple source paths linking.
- Part I. A better way to set up flex unit
- Part II. Using a subproject for ui experimentation and development of helpers for the team
- Part III. The advantages of keeping Data Providers in their own source path
- Part IV. Mock Data as an alternative Data Provider
- Part V. Sub-project to capture the specific environment settings
The ideas presented here were directly inspired by a blog article on a better way to set up flex unit. Unfortunately, the link to the original article is now broken and it hasn't been transferred to raptureinvenice new blog.
When having to take over projects started by others, I have sometimes seen unit tests embedded in the main production code. This is an approach I really don't recommend. I prefer to create two projects. One with the production code, another one with the test units.
I then use the ability to specify multiple source paths to ensure that
- Production, doesn't know anything about test units.
- Test-unit includes the full source of the production code.
This is illustrated below with screen captures taken when in Flash Builder

Once you get the hang of it, it is very easy. A few things to remember
- Package structure must be identical
App/src com/widged/warStories/ TestUnit/unit com/widged/warStories/ - Giving a name other than src to the source folder of your subproject makes it easier to identify the context in which the files are edited.
Downloads
(Require Flash Builder 4)