Structuring Projects For Unit Testing
February 14th, 2008
There have been a couple of questions on the Google FlexUnit list recently about how to structure a project for unit testing. I’m putting my response here so that I can point others at this post in the future.
If you’re interested in doing testing as part of an automated build script, one of the best resources is Antennae. Antennae is an Allurent open source project and does much more than automated testing (compiling, etc.) but it provides a good example of one way to structure a project.
Also, I use a “modified antennae” approach for the Visual FlexUnit (VFU) project. Wheres Antennae tends to use Allurent-standard folder naming (“flex2″, etc.), I decided to use more standard folder names (“src”, etc.) for VFU, so that non-Allurent users would find it a bit easier to incorporate into their projects.
BTW, you might also want to take a look at my Testing, Debugging & Agile Methods page – you’ll find a lot of related links there, and I update it regularly.
HTH!
Allurent’s Antennae & an Ant Overview
May 21st, 2007
It’s been a goal of mine for some time to learn how to implement unit testing, test driven development and continuous integration. I’ve understood these concepts in the abstract but, as a freelance programmer working on my own, the barriers to entry have been a bit too high for me to take the plunge.
With Allurent‘s release of their Antennae Ant-based build framework all this has changed. Antennae provides a framework that automates the entire build/test/deploy process. Its use can speed you on your way to one of the holy grails of software development – the one-click build – for your Flex projects.
Here are a few of its features:
- You can build multiple projects with, of course, one click
- Projects can contain sub-projects
- Some of your projects can be code libraries, and you can specify which libraries each project uses.
- Antennae compiles projects using mxmlc, and libraries using compc…
- And runs unit tests using FlexUnit
Above I said that Antennae will ‘speed you on your way’. Well, speed is a relative thing. If you’re fairly new to Ant (as I was) you’ll still have some studying to do. I invested a good deal of time studying the Ant manual and Antennae’s code. What Antennae did for me was to move my goal from the realm of “I’d like to do this, but where do I start?” to “I can do this!”
As part of my process I decided that I should get a good overview of Ant. I learn best by taking notes so I ended up developing – not precisely an ‘Ant cheat sheet’ – but more of an ‘Ant reminder sheet’. Simply stated, it’s a list of much of what Ant can do in ‘somewhat organized’ format. I don’t know how helpful it would be to others, but you’re welcome to take a look. Here’s a download link (right click & “save link as”):
It’s a Word doc consisting of three pages of fairly fine print, which says something about Ant’s extensive capabilities. Also, be aware that it’s oriented towards Flex developers and omits some of Ant’s extensive Java-related capabilities.
I’m still far from an Ant expert but at least I’ve got an overview. And I’m happy to report that I’ve now implemented the Antennae framework for my own projects and am happily doing one-click builds.
Paul will be presenting at the Bay Area ColdFusion User Group and the meeting will be broadcast live via Acrobat Connect. Meeting time is 7:00 PM PDT, Wednesday May 16. The URL for the broadcast should be available on the group’s site on the day of the meeting. Here’s Jennifer Larkin’s post on the meeting.