CFC Path

When the plugin cannot use its default behavior for figuring out the dot-notation for the project's CFCs, you'll need to tell the plugin what to do. You do this at the project or directory level, in the MXUnit Properties cfc path property.

How

  1. Right click on the project name or a directory in a project in the Navigator or Project Explorer
  2. Select "Properties"
  3. Select "MXUnit Properties"
  4. Set the component root for the project or directory

Explanation

The MXUnit Eclipse plugin needs to turn your files (c:\inetpub\wwwroot\myproject\MyTest.cfc) into the correct cfc path "dot notation" which ColdFusion understands (perhaps it's "myproject.MyTest").

Below I'll describe several different scenarios, each using a different filesystem and project configuration example


The Default Behavior

By default, the plugin will start at the last "segment" of the file path (In this case, "SomeTest"), and travel up the path, a segment at a time, prepending the next segment it encounters and adding a "." (period). It will do this until it reaches the "root" of the project. In this case, the logic would "look" like this (roughly):

loop 1: SomeTest

loop 2: tests.SomeTest

loop 3: MyProject.tests.SomeTest

loop 4: "I'm at the root of the project... stop deriving the path". Return MyProject.tests.SomeTest


Using the cfcpath as a "prefix"

What to do: specify "components" as the cfcpath for this project.

This is what will routhly happen inside the plugin to figure out the CFC path for this file:

loop 1: MyBusinessObjectTest

loop 2: test.MyBusinessObjectTest

loop 2: at project root; sees cfcpath property as "components". Appends that to test.MyBusinessObjectTest, with a period. Return "components.test.MyBusinessObjectTest"


Specifying multiple cfcpath properties in the same project, on any directory

Imagine this scenario: Your applications live at d:\apps, and you have a monster project in Eclipse set up at d:\apps. You have some subdirs that look like: d:\apps\v1\Client1\tests, d:\apps\v2\Client1\tests, etc. And you've added CF mappings like so:

Now... why you'd do this, I don't know. It's an example, live with it. Granted... this is a bit more work; still, it gives you the granularity you need for correctly specifiying the CFC path at any folder level.


Using the "empty" indicator*

Imagine this scenario: Your applications live at d:\apps, and you have a monster project in Eclipse set up at d:\apps. You have some subdirs that look like: d:\apps\App1\tests, d:\apps\App2\tests, and so forth. You have mappings in CF set up that points "app1" to d:\apps\app1, "app2" to d:\apps\app2, etc.

In this case, the easiest choice is to use the "empty" root indicator. In this example, here's what to do:

What's this do? Using a slash (or a period) as the component root property indicates "don't prefix anything underneath this container with a root. In this example, the components under apps\app2\tests would then start at app2.tests, essentially ignoring the "apps" directory.

*Props to a user named Alanyst for suggesting this feature and contributing code

Troubleshooting

Please see this page on the MXUnit wiki for troubleshooting cfc path problems and getting help when all else fails.