Thanks for your replies, Brett and Stephen!

I was able to use the @RunWith with a Suite subclass that would search for
unit tests within jars in the classpath. However, the problem with that
approach is that all the unit tests run within the same JVM. Whereas we want
all the unit tests to be forked, pretty much like forkMode=always.

Looking through the code, it appears to me that I can write my own subclass
of org.apache.maven.surefire.suite.AbstractDirectoryTestSuite and override
its locateTestSets() method (actually I just want to override collectTests()
but that is private) to be able to implement my own test discovery
algorithm.

However, it's not clear to me how I can get surefire plugin to use my
subclass instead of the Junit one. I guess I may have to create my own
surefire-provider? I guess I can do that by starting with (or extending) the
junit4 provider. Lets say I do that how, is there a way to get surefire to
use my provider instead of junit 4.

Cheers,
Anshul



On Fri, Mar 20, 2009 at 1:53 PM, Anshul Jaiswal <[email protected]>wrote:

> Folks,
>
> The surefire plugin currently supports automatically searching for unit
> testing classes from a directory.
>
> I was wondering if there is way for it to search for unit tests from a set
> of jar files instead of a directory. ie., a mechanism where I can specify a
> regex pattern for the package and/or class name and it can search through
> all the jars in the 'test' scope for classes matching that pattern and run
> them.
>
> Thanks in advance!
> Anshul
>

Reply via email to