140 likes | 245 Views
Thomas Burleson. Continuous Testing with Flex & Coldfusion Projects. Oooh no! Not another session of “how to test”…. June 27, 2007. Not another session on “How to test” - already have great online resources for CFUnit , CFCUnit , Flex Unit. So why this session?
E N D
Continuous Testing withFlex & ColdfusionProjects Oooh no! Not another session of “how to test”… June 27, 2007
Not another session on “How to test” - already have great online resources for CFUnit, CFCUnit, Flex Unit So why this session? - stress “if you are not consistently testing, you are crazy!” - no repeatable tests ? - no version control ? - no regression testing ? - No more excuses… - Let the “tools” do the work.
Overview (1) Traditional Approach [CFML] (2) Using Testing Framework(s) (3) Misconceptions (4) Problems with Testing Frameworks (5) Introducing the “Synchronizer” (6) Let the “tools do the work…” (7) Resources….
Traditional Approach (1) Create 1 or more CFCs; each with 1 or more methods … see code examples (2) Create 1 or more CFML pages to test and debug the CFC output … see code examples Note: the above approach is same even if using MVC framework like Mach-ii or Model-Glue This is bad! Let’s see why….
Issues with Traditional Approach it is Ad-HOC (makeshift…)! (1) How do make sure you test each method of an CFC? (2) No way to easily test all .cfcs (3) Does not also test “boundary conditions”. (4) No way to test all functions for all .cfcs regressively (5) Cannot build up a repertoire of tests to verify your code.
Using Testing Frameworks (1) CFUnit or CFCUnit for Coldfusion FlexUnit for Flex (2) Quick Review of CFUnit - Installation - Creating / Using TestCases (3) Using TestRunner CFML to run the TestCases (4) Using Eclipse Ant to runt the TestCases … see example … see example … see example
Common Misconceptions (1) Have to write the test code 1st [ala Test-Driven Development] (2) Have to change development style (3) Its too late… if the code base already exists without tests…
Problems with Testing Framework (1) Too much business code already exists… to tedious to generate for each. (2) Code changes to business CFCs are not mapped to TestCases - reasons: lazy or easy to forget. (3) Updated the TestCases, but forgot to update the TestRunner
Introducing the Synchronizer (1) Always watches the business components (2) Always synchronizes TestCase & test<xxx> methods (3) Auto-updates the TestRunner (4) Does the CRUD - but does not implement the logic! - huh? … see example
Configuring the Synchronizer Understanding Eclipse Ant w/ Synchronizer (1) Modify synchronizer.xml (2) Modify runSynchronizer.xml (3) Launch the Synchronizer - see output in Console (4) Configure the Synchronizer to run during EACH build! … see example … see example … see example You must write the test logic… !
Using the FlexUnitwith Flex (1) Using FlexUnit Framework (2) Building FlexUnitTestcases (3) Configure TestRunner w/ TestCases (4) Launch TestRunner (5) Ant Launch of TestRunner … see example … see example … see example
Using the Synchronizer with Flex (1) Configure to watch .AS files [non-UI files] (2) Auto-Updating TestRunner (3) Ant Launch of TestRunner … see example … see example … see example
Let the tools do the work… (1) Use Test Frameworks (2) Use Synchronizer (3) Use Eclipse Ant (4) Use SVN (5) Use Automated Builds