Notes: Continuous Testing With Flex and ColdFusion Projects
Presented by Thomas Burleson.
Unit testing: Testing functionality of a single unit of code. Could be a webservice, component, UI component, etc.
Continuous testing: Testing all your units in every cycle. Maybe not every time you save, but every time you’re done and you’re about to commit to the repository. Done on the local development machine. Then, automated tasks can connect to subversion and deploy code to the shared dev server.
So why continuous testing? Improve your development style. You will give the perception that you are a great developer because people will see your apps with less bugs, even in beta testing stages. Can save time in the long run.
Traditional approach: Create CFCs, then create CFML pages to test and debug the CFC calls. This is the same even if you are using an MVC framework. Ends up being a bit ad-hoc. How do you make sure you test all methods of all CFCs? Also, doesn’t promote tests of “boundary conditions”. Cannot (or harder) to build a suite of tests. And no regression testing.
Testing frameworks: CFUnit (ColdFusion), cfcUnit (ColdFusion), FlexUnit (Flex), ASUnit (Flash).
Model your test hierarchy after your application hierarchy for a one-to-one reference.
- MyProject
- CFML
- test
- traditionalTests (Standard CFML page)
- tdd (Continuous Test-Driven Development tests using frameworks)
If you know you have a bug, write a test that proves you have the bug! Then fix the bug, and the test will prove that the bug was fixed.
Common misconceptions. Don’t like writing your test code first? Fine. Don’t. Get your hands dirty and then go back and write tests. Don’t like the thought of writing tests for all your code. Fine. Don’t. Do it incrementally.
Why resistant? Not having the time. Or CFCs are changed but test cases are not updated. Or test cases are updated but forgot to update the test runner to run the new test case.
The Synchronizer can help with these complaints. Universal Mind will make this open source, but not available yet. Watches business components, always synchronizes the test case class and methods. Builds the CRUD “shells”. And auto-updated the test runner. So it isn’t intelligent enough to write your tests, but it does that dirty work to make it easier to always include the test.
Conclusion. Use a testing framework. Use Eclipse Ant. Use Synchronizer. Use Subversion. Check out Sean Corfield’s post(s) on automating testing tasks with Ant.
