Update of /cvsroot/openxcf/cfcUnit/cfcunit/tests
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29433/cfcunit/tests
Added Files:
Application.cfc Application.cfm
Log Message:
Added ability to run tests by directly invoking a test class via the url. Check out the following files for examples of how this can be done:
/cfcunit/tests/Application.cfm
/cfcunit/tests/Application.cfc
Once launched, the runner can continue to be used though the original component that was invoked (instead of /cfcunit/index.cfm) when using the included form. Its actually pretty neat.
--- NEW FILE: Application.cfc ---
<!---
Copyright (c) 2006, Paul Kenney
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--->
<cfcomponent
hint="
If any component in this folder (and subfolders) is invoked directly via a Url, this will run it inside the
HTML test runner application and display the results. The runner application will continue to operate
through this url for subsequent requests, including those that run different tests.
">
<cffunction name="onRequest" access="public" returntype="void">
<cfargument name="requestPath" type="string" required="true"/>
<cfset var className = "">
<cfif listLast(arguments.requestPath, ".") is "cfc">
<cfset className = listChangeDelims(listDeleteAt(arguments.requestPath, listLen(arguments.requestPath, "."), "."), ".", "/")>
<cfparam name="url.event" default="runTest" />
<cfparam name="url.runnerType" default="html" />
<cfparam name="url.testClassName" default="#className#"/>
</cfif>
<cfmodule template="/cfcunit/cfcunit.cfm"/>
</cffunction>
</cfcomponent>
--- NEW FILE: Application.cfm ---
<!---
Copyright (c) 2006, Paul Kenney
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--->
<!---
If any component in this folder (and subfolders) is invoked directly via a Url, this will run it inside the
HTML test runner application and display the results. The runner application will continue to operate
through this url for subsequent requests, including those that run different tests.
--->
<cfset contextRoot = getPageContext().getRequest().getContextPath()>
<cfset requestPath = cgi.script_name>
<cfif findNoCase(contextRoot, requestPath, 1) is 1>
<cfset requestPath = replaceNoCase(requestPath, contextRoot, "", "one")>
</cfif>
<cfif listLast(requestPath, ".") is "cfc">
<cfset className = listChangeDelims(listDeleteAt(requestPath, listLen(requestPath, "."), "."), ".", "/")>
<cfparam name="url.event" default="runTest" />
<cfparam name="url.runnerType" default="html" />
<cfparam name="url.testClassName" default="#className#"/>
</cfif>
<cfinclude template="../Application.cfm"/>
<cfmodule template="/cfcunit/cfcunit.cfm"/>
<cfabort/>
|