| Issue 141: | Allow component root to be project root | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? 1. Create Eclipse project with project root outside of webroot, and add path /test/testSomething.cfc to the project. (testSomething.cfc should be a valid MXUnit test case.) 2. Create CF mapping 'testProject' to project root, so that CF recognizes test.testSomething as a valid component path. 3. Try to use the MXUnit Eclipse plugin to execute the project's tests. It will fail because MXUnit expects the component root to be the webroot, which is not the case. 4. Set the component root for the project to something else. The plugin will still fail to recognize the test suite because the component root is set relative to the project root, but the component root cannot be empty and still recognized. What is the expected output? What do you see instead? There should be a way to specify an 'empty' component root so that the project-relative path for test CFCs gives the correct component path. What version of the product are you using? On what operating system? Please provide any additional information below. I have downloaded the source code and fixed this problem by modifying PathUtils.java to accept "/" as a special component root that means "no prefix". I have tested this in my Eclipse installation and I can run my tests now with the project setting of "/" for the component root. Patch for the file is attached.
Nov 23, 2008
Project Member
#1
virtix
Cc:
marc.esher
Nov 23, 2008
Alan, thanks! I'll roll this into the other changes I made last week to the way test suites are created. Now that you're familiar with the mxunit plugin code, have a look at TestSuiteCreator.java to see how it's changed. I did this to support setting the component root at any resource level, not just the project level. I haven't released it yet b/c i haven't written the documentation for it. Here's what i'm thinking: your fix caters to what *most* people actually want to do, which is have an empty component root. so i'll use that as the "if this is your situation, use the /". for people who need more granular control, i'll explain the changes I made. i think, finally, this whole business is solved. it's funny, bill: I always assumed this was a case I'd just never support. Funny how you actually want to get things working when people ask for it. Even better when people contribute patches!
Nov 28, 2008
Hey Alan,
so, turns out that when I rewrote the code that derives the cfc path, I removed
PathUtils from the equation entirely. Gone. All the work is now done in
TestSuiteCreator.java since it now doesn't use string parsing but instead uses
Eclipse's built-in path functionality.
As I said, the reason I did all this was to make it possible to set cfc paths at
any resource level, not just the project level.
I did not integrate your fix, but I was wondering: would you like to? If so, I'll
be glad to have it! Just go to actions.TestSuiteCreator.java and have at it. The
important method in that file is deriveCFCPath. The important chunk of code for you
will most likely be around line 148:
propValue = props.getComponentPropertyValue(currentParent).trim();
if(propValue.length()>0){
path = propValue + "." + p.removeFirstSegments(i).toString().replaceAll("/", ".");
break;
}
If you don't want to have at it, that's cool.
thanks!
Dec 2, 2008
Marc, it appears that you arrived there before I did. I'll be giving the new code a try today. Thanks for your work!
Dec 2, 2008
your code was extremely easy to integrate into the revised TEstSuiteCreator, so i just gave it a go. thanks a lot for the idea and the contribution... you've been immortalized in the plugin's Help documentation. The fame.... the glory... the power! The chicks will swoon!
Dec 2, 2008
marking this as fixed. code deployed.
Status:
Fixed
|