Download to get rid of those pesky bugs.             MXUnit Unit Testing framework for ColdFusion developers                               Download       Details       Home       Support       Blog

Running entire directories of Tests with one line of code

When you have a multiple tests all residing in a directory and subdirectories, it's very conventient to run everything contained in those directories. In this context, a directory of tests implies a test suite, and MXUnit enables you to run directories as test suites.

Running directories of tests can be done with a single line of code:

<cfinvoke component="mxunit.runner.DirectoryTestSuite" 
              method="run"
              directory="#expandPath('/mxunit/PluginDemoTests')#" 
              recurse="true" 
              excludes="InvalidMarkupTest,FiveSecondTest"
              returnvariable="results" />
Explanantion:

Once this is exectuted you can easily output the results to the screen:
<cfinvoke component="mxunit.runner.DirectoryTestSuite" 
              method="run"
              directory="#expandPath('/mxunit/PluginDemoTests')#" 
              recurse="true" 
              excludes="InvalidMarkupTest,FiveSecondTest"
              returnvariable="results" />

<cfoutput> #results.getResultsOutput('extjs')# </cfoutput>  
 
Copy the above to a file called /mxunit/doc/tutorial/directoryRunner.cfm and run it: http://localhost:8500/mxunit/doc/tutorial/directoryRunner.cfm

You should see this:


2008 MXUnit.org