Directory Test Suite Relativity Check

8 views
Skip to first unread message

Randy

unread,
Sep 15, 2008, 2:56:02 PM9/15/08
to mxunit
I am working on setting up the ant task to run a directory of tests
and was having trouble since it is expecting an absolute path for the
directory.

I could hard code the full path into the ant build file, but would it
work still if you changed the code around line 88 of the
DirectoryTestSuite.cfc to be this:

<cfif not DirectoryExists(arguments.directory)>
<cfset arguments.directory = expandPath(arguments.directory) />

<cfif not DirectoryExists(arguments.directory)>
<cfthrow message="Directory #directory# does not exist">
</cfif>
</cfif>

Then you could give it a relative path and still have the tests work?
This would save me time in that I wouldn't have to worry about hard-
coding in the path on each project since the relative path doesn't
change between projects.

Randy

billy

unread,
Sep 15, 2008, 4:55:38 PM9/15/08
to mxunit
Good suggestion, Randy. Thanks for the patch! I think we can put this
into the next build.

bill

Marc Esher

unread,
Sep 15, 2008, 5:48:01 PM9/15/08
to mxu...@googlegroups.com
i was going to put out a new version of mxunit tonight or tomorrow.
could someone throw together a unit test for this new behavior from
randy? then we can include it in tomorrow's release.

thanks.

marc

Paul Marcotte

unread,
Sep 15, 2008, 6:02:58 PM9/15/08
to mxu...@googlegroups.com
Randy,

When I run tests using the ant task, I pass the path into the mxunit plugin using the basedir property. For example, my build file is in the root of the project and the tests in the "tests" directory.  I have an init target with

<property name="testdir" value="${basedir}/tests" />

and then use

<directory path="${testdir}" componentPath="tests" recurse="true" /> within the <mxunittask /> target.

Paul
--
Paul Marcotte
Fancy Bread - in the heart or in the head?
http://www.fancybread.com

Randy

unread,
Sep 15, 2008, 6:14:18 PM9/15/08
to mxunit
That is not a bad idea, but it makes more sense, imho, to have it use
the relative paths, you don't have to worry about generating the base
directory and it will act like your normal mappings in ColdFusion
since the expandPath will use those mapped directory location. It
would also make it nice if your project ever had test in more than one
directory yet they are all mapped in CF.

Randy

Paul Marcotte

unread,
Sep 15, 2008, 6:22:05 PM9/15/08
to mxu...@googlegroups.com
I agree that your suggestion makes sense, just offering my (2 cents) approach.  :)

Paul

Randy

unread,
Sep 15, 2008, 6:26:56 PM9/15/08
to mxunit
Thanks for the suggestion Paul, I like collecting cents... they add
up... ;)

Randy

Randy

unread,
Sep 19, 2008, 12:55:44 PM9/19/08
to mxunit
Working with the DirectoryTestSuite again the same directory expanding
could be done around line 19 where it does the normalize on the
directory... maybe it could be put into the normalizeDirectory
function so that both the getDirectoryQuery and run could use it ?

Randy

Marc Esher

unread,
Sep 22, 2008, 10:46:44 AM9/22/08
to mxu...@googlegroups.com
this and its corresponding tests are now in subversion.

thanks for the code, Randy.

marc

Marc Esher

unread,
Sep 25, 2008, 8:15:38 AM9/25/08
to mxunit
All, this is now in the 1.0.3 release. You can get it from http://mxunit.org

marc

On Sep 22, 10:46 am, "Marc Esher" <marc.es...@gmail.com> wrote:
> this and its corresponding tests are now in subversion.
>
> thanks for the code, Randy.
>
> marc
>

Randy

unread,
Sep 25, 2008, 9:14:39 AM9/25/08
to mxunit
I switched over last night... ;)

Thanks for all the hard work!

Randy

Marc Esher

unread,
Sep 25, 2008, 9:31:10 AM9/25/08
to mxu...@googlegroups.com
It was very laborious... copying and pasting your code.

my mouse hand still hurts!

Randy

unread,
Sep 26, 2008, 12:06:28 AM9/26/08
to mxunit
So I've found a little bug with the fix. Well not really a bug with
mxunit.. and it may just be me... but with Railo the DirectoryExists()
function doesn't return false if it is able to find the path from the
root of the server (maybe application?) not just from the root of the
box. I've submitted an issue with Railo ( https://jira.jboss.org/jira/browse/RAILO-119
) so we shall see if it really is a bug or if it is just me being
retarded.

Randy

Marc Esher

unread,
Sep 26, 2008, 7:23:39 AM9/26/08
to mxu...@googlegroups.com
Cool, thanks a lot for posting that to railo. They've been a pleasure
to work with.

marc

Reply all
Reply to author
Forward
0 new messages