You can hack it to run a test suite. I found this on a post somewhere, so
don't give the credit to me. :-)
<!-- To force maven to run the test suite -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- To force maven to run the suite -->
<includes>
<include>**/MavenSuite.java</include>
</includes>
<excludes>
<exclude>**/*Test.java</exclude>
</excludes>
</configuration>
</plugin>
public class MavenSuite extends TestCase {
/** The test result. */
private TestResult tr;
/** */
public void testSuite() {
TestSuite suite = (TestSuite) AllTests.suite();
suite.run(tr);
}
/**
* @see junit.framework.TestCase#run(junit.framework.TestResult)
*/
public void run(TestResult res) {
tr = res;
testSuite();
}
}
It's not as nice a solution since when surefire runs it looks like it's only
running *one* test. I recommend not using a suite, but this was a quick
solution that I found for another project. I've only tried this with junit
3.8, jdk 1.4 (it was an older project)
Jim
On 9/12/07, Sebastian Johnck <[EMAIL PROTECTED]> wrote:
>
> I had the this way working for a while using annotations like so:
> @Suite.SuiteClasses( { ServicesSystemTestSuite.class })
> @RunWith(Suite.class)
> Using junit 4.2, but library conflicts and some transitive dependency on
> junit 3.8 started causing errors.
>
> So now I have reverted to the old way like so:
>
>
> public static junit.framework.Test suite() {
>
> TestSuite suite = new TestSuite();
> suite.addTestSuite(ServicesSystemTestSuite.class);
>
> return suite;
> }
>
>
> On 9/12/07, Kalle Korhonen <[EMAIL PROTECTED]> wrote:
> >
> > I looked at it at one point and came to the same conclusion that there's
> > no
> > support for running suites. Wouldn't mind be proven wrong though.
> >
> > Kalle
> >
> >
> > On 9/12/07, mfs <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Hello Folks,
> > >
> > > Am looking into how having a suite in junit4 (or even earlier
> versions)
> > > can
> > > integrate with the way maven2 runs the junit test-cases, i mean if we
> > are
> > > using maven to run the test-cases, can having a suite make any
> > > difference?...because maven eventually will be running all methods
> which
> > > have @Test as a prefix (for Junit 4) or otherwise run methods with
> test
> > as
> > > prefix (for junit3 and earlier). Does sure-fire plugin has any support
> > for
> > > it ? doesnt seem so ?
> > >
> > > Thanks and Regards,
> > >
> > > Farhan.
> > > --
> > > View this message in context:
> > >
> >
> http://www.nabble.com/suite-in-junit-and-maven-2---do-they-work-together-tf4430242s177.html#a12638433
> > > Sent from the Maven - Users mailing list archive at Nabble.com.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>
>
>
> --
> Sebastian Johnck
> (415) 425 - 8361
>
> ~~~~~~~~~~~~~~~~~~~
> MotionBased Technologies
> 180 Harbor Dr.
> Sausalito, CA 94965
> www.motionbased.com
> Coordinates:
> N 37° 51' 33"
> W 122° 29' 08"
> ~~~~~~~~~~~~~~~~~~~
>