Running directories of tests

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:


  • component: The MXUnit runner component responsible for running all the tests.
  • method: The component's method being invoked.
  • directory: A physical path to the directory containing your tests.
  • recurse: A flag to indicate whether or not to run tests in all subdirectories.
  • excludes: A list of component names to exclude.
  • componentPath: A class path to the directory containing your tests. This gives MXUnit the needed hint to how your web server and engine sees
    your tests. Without it, MXUnit attempts to use an Adobe CF component.
  • returnvariable: The variable name of the TestResult object returned
  • componentPath: (Not listed above) Optional parameter that increases performance. This is the component name prefix; e.g., If not specified, MXUnit will locate the full component name using the ColdFusion server cache of components.
  • This will pick up any file that starts or ends with the word "Test", but excluding anything in your "excludes" attribute

Once this is exectuted you can easily output the results to the screen:

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:

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.