Sammy,
I use CFUnit for unit testing my model layer.  I ran into 'testing issues' when trying to test the CRUD (DAO) & Gateway layers. By testing issues, I mean how I loaded the test values into the test cases and checked the results.  I did not want to write all these cases into the actual test b/c my long range plan is to be able to add more test cases and scenerios w/out modifying the testing code.  So I created an XML file that I use to load the test cases.  My 'tester' CFC class loads the XML data and pushes it through the testing process.  The XML file store the expected results so the test condition can be easily changed as well.  Here's a quick sample of the XML file:
         <create name="insert1">
            <Prefix>Mr.</Prefix>
            <FirstName>Jason</FirstName>
            <LastName>Daiger</LastName>
            <Company>Attendee Interactive</Company>
            <Email1>[EMAIL PROTECTED]</Email1>
            <Result value="true"/>
            <Description>Standard insert</Description>
         </create>
The Result is the condition w/in CFUnit.  This approach is working for me but I still have issues when reading multiple rows back since the state of my test db is always changing.  However at John Ashenfelter's CFUnited talk he mentioned DBUnit which sounds like it will address that aspect of my testing plann.  Now to learn how to use DBUnit, CFUnit and Ant to automate the setup and running of my unit testing.  And then after that is to use CFUnit to test the display layer and then Selenium for the functional layer. 
 
-Jason
Yahoo! ID: jasondaiger


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy Larbi
Sent: Saturday, July 22, 2006 12:00 PM
To: [email protected]
Subject: [CFCDev] unit testing in CF

I wrote this question (actually, a similar one, since I don't have a copy here) a couple of days ago.  I didn't get a response, and I don't recall seeing that I even got a copy of the message I sent.  So, apologies if you got this already and didn't care, =) but I'm going to ask again:

Do any of you practice unit testing your cf code, for example with cfunit?  If so (or not- why not?), how have you handled unit testing the model layer, for example.  I'm finding it tedious to test, and wondering if anyone's got any good ideas they wouldn't mind floating my way. 

Thanks,

Sammy Larbi
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to