Problems with mxUnit in an Ant build file

7 views
Skip to first unread message

Andrew Scott

unread,
Sep 30, 2009, 8:18:45 PM9/30/09
to mxunit
I have a scenario where I have the following project defined.

projectroot
->build dir
->src
->src->wwwroot
->src->wwwroot->com (normal directory for components)
->unitTests
->mxunit

Now the webroot is defined by the webserver (IIS) as wwwroot and the
mxunit and unittests are defined as IIS virtual directories.

If I RMB and run the test with that option the tests run fine, however
in Ant it seems to strip the unitTests from the path and tries to run
the ".com.somedir.componentTest"

kk, so what is the problem that I am doing wrong here?

~Andrew

Marc Esher

unread,
Sep 30, 2009, 9:24:01 PM9/30/09
to mxu...@googlegroups.com
can't help unless we see how you're using the ant task. give us some code man.

Andrew Scott

unread,
Sep 30, 2009, 9:47:25 PM9/30/09
to mxunit
Like this

<target name="runtests" description="Run a dir of tests recursively">
<taskdef name="mxunittask" classname="org.mxunit.ant.MXUnitAntTask"
classpath="${mxunit.jar}" />
<mkdir dir="${basedir}\testresults" />
<mxunittask server="127.0.0.1" port="80"
failureproperty="testsfailed"
defaultrunner="/mxunit/runner/HttpAntRunner.cfc"
outputdir="${output.dir}" verbose="true"
haltonerror="true"
>
<directory path="${basedir}\unitTests\" recurse="true" />
</mxunittask>
</target>

The error is...

coldfusion.runtime.TemplateProxyFactory$InvalidComponentNameException:
The .com.componentDir.componentTest name is not a valid component or
interface name.
at coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper
(TemplateProxyFactory.java:1371)
at coldfusion.runtime.TemplateProxyFactory.resolveName
(TemplateProxyFactory.java:1330)
at coldfusion.cfc.ComponentProxyFactory.getProxy
(ComponentProxyFactory.java:38)
at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65)
at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:4707)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4552)
at cfTestSuite2ecfc490144102$funcADDALL.runFunction(C:\Projects
\frameworks\mxunit\framework\TestSuite.cfc:103)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
360)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke
(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke
(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:448)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:308)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2272)




On Oct 1, 11:24 am, Marc Esher <marc.es...@gmail.com> wrote:
> can't help unless we see how you're using the ant task. give us some code
> man.
>

bill shelton

unread,
Oct 1, 2009, 6:01:45 AM10/1/09
to mxunit
Andrew,

Try this. Change your directory task to include a component path
(Omitting it is deprecated).

<directory path="${basedir}\unitTests\" recurse="true"
componentPath="unitTests" />

Let me know if that works. It "looks" like refelection/metadata
issue ... Also, forgive my ignorance, but what is "RMB"?

bill

Andrew Scott

unread,
Oct 1, 2009, 7:06:27 PM10/1/09
to mxunit
seems weird to me.

I dont do that for the mxUnit view, and it works fine. I'll give it a
try and see how it goes.

Andrew Scott

unread,
Oct 1, 2009, 7:07:12 PM10/1/09
to mxunit
nope same error.




On Oct 1, 8:01 pm, bill shelton <vir...@gmail.com> wrote:

billy

unread,
Oct 2, 2009, 1:52:49 PM10/2/09
to mxunit
Andrew,

I'm trying to reproduce this now. What do you mean by mxUnit view?

For what it's worth, the Ant task is really just a simple http client.
This may be something to do with the HttpAntRunner and how the
TestSuite is created.

bill

denstar

unread,
Oct 2, 2009, 4:20:33 PM10/2/09
to mxu...@googlegroups.com
Yeah, my wait for the last minute, swoop in with solution solution was
going to be the componentPath attribute. Good thing I held off.

I'm thinking that to get around whatever is happening, Andrew could
put his HttpAntRunner.cfc in a directory with an Application.cfc, and
then define per-app mappings in that Application.cfc, maybe?

I think the real issue is that the IIS virtual directories aren't
quite like CFML mappings, so the wonky-ness is probably coming from
that.

Another solution might be adding mappings in the admin, but honestly,
the component name should be the full path-- that it's missing the
unitTests prefix I think is another clue.

Heh. Wonder if you put the unitTests in another subdirectory called
unitTests, if it would work. (unitTests/unitTests/). I doubt it. I
think it's the IIS virtual directory deal.

--
I think that consciousness has always been the most important topic in
the philosophy of mind, and one of the most important topics in
cognitive science as a whole, but it had been surprisingly neglected
in recent years.
David Chalmers

Andrew Scott

unread,
Oct 4, 2009, 8:42:42 PM10/4/09
to mxu...@googlegroups.com
Well the weird thing is that it sometimes works and sometimes doesn't.
 
For example, I could be writing away and next I will be getting an error, and the ant script will stop. I'll stop ColdFusion and Restart it and sometimes there is a 15% chance that it will start working again.
 
It has me stumped, because when I first set this up it worked off the bat and it just stopped for no reason at all.
 
As for the Ant View, if you aren't using Eclipse then it is pointless trying to explain that to you then.
 
Also I was thinking that there is no reason why there can't be a better integration between the Ant Script and the mxUnit view in eclipse. I am not sure how it would be done, but I am sure that this could be achieved to run the ant script an opne the mxUnit view, and display the unit tests in there rather than a console dump of passed failed etc.
 
Something to think about.
 

billy

unread,
Oct 5, 2009, 9:30:43 AM10/5/09
to mxunit
Hi Andrew,

> Well the weird thing is that it sometimes works and sometimes doesn't.
That's frustrating, and especially difficult to support if it's not
reproducable. Did you try Denny's suggestion of Placing the
HTTPAntRunner.cfc in your application directory and pointing your
build file to that instead of /mxunit/runner/HttpAntRunner.cfc?

> Also I was thinking that there is no reason why there can't be a better
> integration between the Ant Script and the mxUnit view in eclipse.
I agree that there's no technical limitation. It sounds a bit like how
Cedric built TestNG, using xml for test suite configuration. But, most
MXUnit folks use the MXUnit Ant task as a way to facilitate automated
test runs and continuous integration. I'm likely missing something,
but I'm not seeing how integrating the MXUnit Ant task into the MXUnit
Eclipse plug-in will provide any additional functionality. Maybe you
could clarify a use case and make a feature request -
http://code.google.com/p/mxunit/issues/entry?

bill

Andrew Scott

unread,
Oct 5, 2009, 7:15:13 PM10/5/09
to mxu...@googlegroups.com
nope,
 
I just removed the application.cfm file.

Andrew Scott

unread,
Oct 5, 2009, 7:17:48 PM10/5/09
to mxu...@googlegroups.com
Simple,
 
I cant see which test failed, unless I got to the browser and point and click around there.
 
It would maybe be better to see which tests are being run, which have failed via the mxUnit view. Make a change, and rerun that test only till it passes. I don't want to be forced to leave my IDE to browse a web version of what the mxUnit view can offer.
 
 


 
On Tue, Oct 6, 2009 at 12:30 AM, billy <vir...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages