Test suites running other suites

1 view
Skip to first unread message

Alan Livie

unread,
May 2, 2008, 10:33:30 AM5/2/08
to mxu...@googlegroups.com
I have moved from cfcunit to mxunit and I'm loving the framework.

One thing I couldn't find in the docs is how to have a suite add other suites.

ie I can add a test using

testSuite.addAll("path.to.my.test");

in cfcunit I can also add a suite to a suite (ie a composite of suites and tests)
This is handy as I can then run smaller suites rather than the full whack.

Can I do this? Apologies if I'm being stupid :-)

Alan

billy

unread,
May 3, 2008, 7:38:25 AM5/3/08
to mxunit
Hi Alan,

Thanks for the kind words. You're question has come up before, so, you
are not missing anything. Currently MXUnit only allows you to add
TestCases to TestSuites. With that said, we do plan in version 1.1 to
add in this composite capability. So, that may be sometime this Summer
after CFUnited. However, in lieu of creating explicit TestSuites, many
of us have found benefit using MXUnit's DirectoryTestSuite, which can
run every test, with optional recursion, in a directory. You can
exclude specific files, too. Additionally, using the MXUnit Eclipse
plug-in, you can search for directories, load tests, and run only the
one you want. This has the distinct benefit of not having to write any
explicit TestSuites; you just keep your tests in a test directory.

Hope this helps.

bill[y]

Alan Livie

unread,
May 3, 2008, 8:01:11 AM5/3/08
to mxu...@googlegroups.com
Thanks for the reply Billy.

I'll look into the DirectoryTestSuite.

I'm using the Eclipse plugin and its excellent. Its actually the reason I now actually spend 50% of my time doing 'Test First' development.

Why not 100%? Old habits die hard ;-)

Look forward to v1.1.

Alan
________________________________________
From: mxu...@googlegroups.com [mxu...@googlegroups.com] On Behalf Of billy [vir...@gmail.com]
Sent: 03 May 2008 12:38
To: mxunit
Subject: [mxunit:379] Re: Test suites running other suites

Marc Esher

unread,
May 3, 2008, 8:44:22 AM5/3/08
to mxu...@googlegroups.com
Alan, you should be able to include entire directories in the
"excludes" attribute of directory test suite, too. for example, if you
had packages like this:

tests.blog.rss
SimpleRSSTest.cfc
SomeOtherRSSThingieTest.cfc
tests.blog.comments
BlahTest.cfc
tests.blog.spamfilter
Blah2Test.cfc

and you wanted to NOT run the spamfilter tests, you could do:

<cfset dir = expandPath(".")>
<cfset DTS = createObject("component","mxunit.runner.DirectoryTestSuite")>
<cfset excludes = "spamfilter">
<cfinvoke component="#DTS#"
method="run"
directory="#dir#"
recurse="true"
excludes="#excludes#"
returnvariable="Results"
componentpath="tests">
<cfoutput>#results.getResultsOutput("extjs")#</cfoutput>

If that filtering does not work for you, please let us know.

best,

marc

Reply all
Reply to author
Forward
0 new messages