This post is to explain how to test your cfc to make sure they are working the way that you meant. I am wondering if it is possible to test a cfc directly using cfdump? However, since you don’t run a cfc directly, this may not work.


<cfcomponent>

    <cffunction name="getArtist" access="remote" returntype="query">
        <cfset var qRead = "" />

        <cfquery datasource="cfartgallery" name="qRead">
            SELECT artistid, firstname, lastname, email
            FROM artists
        </cfquery>

        <cfreturn qRead />
    </cffunction>

</cfcomponent>

to test the cfc I create a test file and invoke the cfc and then use cfdump to see the results


  <cfinvoke
     component="ArtistGateway"
     method="getArtists"
     returnVariable="qRead">

     <!--- dump the output--->
     <cfdump  var = "#qRead#">

Happy Coding

By |2009-12-20T21:39:54+00:00December 20th, 2009|