Understanding assertions
I am going to place all my tests for the book in a folder called share
. This is my habit, but you could place your tests in different directories as you choose. I will create a folder called tests
within the share
folder of the server root, if it does not exist. Lastly, I will create a folder called cf9dt
to place the tests for this book: /share/tests/cf9dt/
.
First test class
The very first thing we need to learn is that all test methods need the word "Test" in them. This is the way MXUnit spots the tests. Let's create a file called assertTest.cfc
in the directory we created to hold our tests. Place the following code in this file:
<cfcomponentdisplayname="assertTest"extends="mxunit.framework.TestCase"> <cffunction name="setUp"> </cffunction> <cffunction name="tearDown"> </cffunction> <cffunction name="firstTest"> <cfset fail("not yet implemented")> </cffunction> </cfcomponent>
I will get right...