Paul,

Thanks for the info.  As far as the application variables go, they are being
passed into the object via the constructor (the init function), but it was
the test case that was passing in the application variable via the
constructor.  This way, I don't have to duplicate the information in the
Application.cfc file in every test case thus making changes more difficult
down the road when a data source or mapping change.

Thanks
-- Jeff
 

-----Original Message-----
From: Paul Kenney [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 25, 2005 11:58 PM
To: CF-Talk
Subject: Re: CFUnit Help ... assertEqualsBoolean?

Jeff,

cfcUnit and CFUnit are a bit different in how assertions are made. In CFUnit
(like JUnit) there is a single function name "asserEquals". JUnit can take
advantage of method overloading, so a single method name with different
argument types will work. CFUnit takes the same approach and only has one
assertEquals method that can accept any type for its expected and actual
arguments, and it determines the type of assertion/comparison that needs to
be done based on the determined type of the "expected" argument. cfcUnit is
done differently. I have found that implying the type of test that needs to
be done based on the types of the arguments gives up too much control and is
harder to understand down the road. Instead, each type of assertion has its
own method that is called explicitly by the test case methods. This is the
default behavior for cfcUnit and does not require the use of any special
base class.

As far as testing for the presense of application variables within your test
cases or making your objects under test aware of them, it is a bad practice
(except in certain cases) and leads to untestable code. If you need these
values to be available to your objects, it is best to pass them in
explicitly via the constuctor or other method arguments.

I hope this helps.

Paul

On 11/25/05, Jeff Chastain <[EMAIL PROTECTED]> wrote:
>
> Well, the reason I was going with the assertEqualsBoolean() was, how 
> can an equality test tell if a given string is a string or a boolean 
> type?  I am getting the following failure ...
>
>         testIsNullID(crTracker2._com.test.propertyTest): : 
> expected:<...> but was:<...>
>
> .... which I assumed had to do with the fact it was trying to compare 
> the string 'YES' with the boolean value 'true' and coming up short.  
> Now that I change the extends to grab the extra functions though, I am 
> still getting the error above.  It is not the most descriptive as to 
> where the problem is .....
>
> As a brief aside, I went and checked out CFCUnit to see if it was any 
> better documented.  However, when setting up a test case there, it 
> does not appear that the execution of the test case includes the 
> Application.cfc file for the project.  Am I missing something here or 
> am I doing something wrong by utilizing application level variables 
> (dsn, cfc mapping, etc.) in my test cases to pass to the object?
>
> Thanks
> -- Jeff
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225316
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to