maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Camblor <>
Subject Re: surefire plugin - test a specified method only instead of a specified class using the test parameter
Date Sun, 03 May 2009 20:00:33 GMT
Hi Kostas,

As Wayne answered, this would rather be a Junit question than a maven
question ;-)

With junit 3, you can override the "public void run(TestResult)" : inside
this method, the getName() method will return the current "test name" which
corresponds to the test method to execute for the current test case.

Then, you could be able to check a property of your choice defining the
FQN+method name to precisely execute (given to maven via
=> you'll call if and only if :
- your property is set and getClass().getName()+"."+getName() corresponds to
your current system property value
- your property is not set

=> That implies a refactoring of every of your test classes in order to be
able to inherit from you super testcase class overriding the run(TestResult)


2009/5/3 Wayne Fay <>

> > Do you know if surefire allows to explicitly test one method only? Is
> there
> > a way to achive that at all?
> Put each of your tests into different classes, with one method each.
> Or write an Ant script or something to do this, and just let Maven do
> the compile etc, then you run the test manually.
> This really falls outside the scope of normal Maven usage which is why
> its not supported.
> Wayne
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message