Really, CFUnit is just a shallow implementation of JUnit (I wouldn't really
call it a port).  

CFUnit only has two components, TestCase and TestSuite.  These two classes
are responsible for running the tests, collecting the test info and
displaying the results.  Really compact, but difficult to extend because
everything goes on in these two objects.  They are also tightly coupled to
the HTML presentation layer.  With Junit, you have TestRunner, TestListener,
and TestResults, TestCase and TestSuite. 

TestRunner is the class that is responsible for collecting all the TestCase
objects, executing each of them, collecting the results of each test, and
providing the results to TestListener objects and the caller.  

TestListener provides an interface for notifcations from the TestRunner (or
whoever wants to send it a message) upon the beginning of each test, the end
of each test, and any failure encountered within that test. TestListener is
really just an interface that you implement, and you can do anything you
want with the information provided through the notification interface.  This
follows the Observer pattern.  Custom Listeners can be added to the
TestRunner via an "addListener" method.

TestCase is extended by the test writer.  For each public method starting
with "test" and returning void, a TestCase is created and run by the
TestRunner.

TestSuite is responsible for aggregating TestCases that are to be run
together.  TestSuite objects can also contain other TestSuite objects (ala
Composite pattern)

TestResults is passed into each TestCase as a Collecting Parameter by the
TestRunner.  The TestCase records success/failure/error information to the
TestResults object.  When the run of tests is over, the TestRunner's
execute() method returns the TestResults to the caller.


Using and extending these basic (and decoupled) components, you can create
different kinds of variations on the general framework.  Right now, I have a
simple Text UI and a more elaborate HTML presentation.  One thing I have
been thinking about is writing a test runner that could be run through
Dreamweaver as a floating panel using remote calls to the CF Server (kind of
like is attempted with the CF Debug panel).  I just have to write a new
presentation layer in HTML/JS in DWMX and a new remote interface on the
server.


CFUnit is great, but I think this is just better ;).

BTW, I'll be giving a lecture on this at SacCFUG in May.



Paul Kenney
WebMaster, CorporateWarriors.com
916-663-1963


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Sean A Corfield
Sent: Friday, March 19, 2004 11:01 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] JUnit with Cold Fusion


On Mar 19, 2004, at 10:51 AM, Paul Kenney wrote:
> When I first saw CFUnit, I thought "cool!", but what if...
>
> So I looked at Junit and decided that a faithful port to CFML that 
> followed
> the JUnit API as closely as possible could be really useful.

Hmm, I was under the impression that CFUnit was already a port of JUnit 
to CFMX? Could you briefly explain how different it is? (I'm not 
particularly familiar with either).

Thanx,
Sean

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.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'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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

Reply via email to