O'Reilly logo

ColdFusion 9 Developer Tutorial by John Farrar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required