My tests are spread across folders and projects. Each project has its own
suite test, with which you must register the individual tests. Then there is
a super suite which registers each project suite.
To exclude or include the suite tests in the separate phases I am running, i
use maven includes and excludes elements in the surefire plugin.
On 9/12/07, Farhan Sarwar <[EMAIL PROTECTED]> wrote:
>
> interesting but not a good way to go ahead with (as also you
> suggested), more because this way you would have to configure in every
> project's pom the directory where the test-cases reside (so as to
> exclude them) what if the test-cases reside in one more than one
> folder (for a single project) the same would need to be done for all,
> which is sort of cumbersome, it would have been great if there was
> someway we could have configured surefire to run the suites (i.e. if
> found in a project) instead of the individual test-cases, don't know
> if thats too much of an expectation..
>
> Farhan.
>
>
> On 9/12/07, Jim Sellers <[EMAIL PROTECTED]> wrote:
> > 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"
> > > ~~~~~~~~~~~~~~~~~~~
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Sebastian Johnck
~~~~~~~~~~~~~~~~~~~
MotionBased, A Division of Garmin International
180 Harbor Dr.
Sausalito, CA 94965
www.motionbased.com
Coordinates:
N 37° 51' 33"
W 122° 29' 08"
~~~~~~~~~~~~~~~~~~~