You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Joel Wiegman <Jo...@btservices.com> on 2007/10/18 16:12:14 UTC

Junit 4 or TestNG 5 suite support

Members of the Maven council...

Is Surefire's support for "suite" functionality limited to Junit 3?

TestNG's @BeforeSuite and @AfterSuite annotations are not supported by
Surefire.

Junit 4's equivalent to these methods are to set up a class as follows:

@RunWith(value=Suite.class) 
@SuiteClasses(value={MyFirstTest.class, AnotherTest.class})
public class AllTests {

	@BeforeClass
	public void doStuffBeforeSuiteRuns() {
		...
	}

	@AfterClass
	public void doStuffAfterSuiteRuns() {
		...
	}

	@Test
	public void testMyStuff() {
		...
	}

}

I then point Surefire to this class and it says no tests were found
(!!!) (and yes, it found the class).  Even the testMyStuff() method was
not found as a test!

Is there some matrix out there that shows what annotations are supported
by Surefire?  Does anyone else out there have code running before/after
their suites with Junit 4 or TestNG 5?  Is my only option here Junit 3
(frown)?

Thanks so much!

Joel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Junit 4 or TestNG 5 suite support

Posted by Joel Wiegman <Jo...@btservices.com>.
Found a relatively reasonable work-around for this problem (by not using
surefire at all).  I can now use the @BeforeSuite and @AfterSuite
functionality of TestNG (and probably the suite functionality of Junit
if I ever need to switch).

Instead of using surefire, I'm using the maven antrun plug-in as
follows:

<build>
  <plugins>
  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <phase>test</phase>
        <configuration>
          <tasks>
            <taskdef name="testng" classname="org.testng.TestNGAntTask">
            	<classpath refid="maven.test.classpath"/>
            </taskdef>
            <testng classpathref="maven.test.classpath"
             outputDir="${project.build.directory}/surefire-reports"
             sourcedir="${project.build.testSourceDirectory}"
             workingDir="${basedir}"
             haltonfailure="true">
               <xmlfileset dir="src/test/resources"
includes="integrationTests.xml"/>
            </testng>
          </tasks>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  </plugins>
</build>

Hope this helps somebody...


-----Original Message-----
From: Joel Wiegman [mailto:JoelWiegman@btservices.com] 
Sent: Tuesday, October 23, 2007 9:24 AM
To: Maven Users List
Subject: RE: Junit 4 or TestNG 5 suite support

Well, one reason could be that I haven't found a defect related to suite
support for either TestNG or Junit.

Does one exist already or is one needed?  I'm guessing they should be
separate defects? 

-----Original Message-----
From: Wim Deblauwe [mailto:wim.deblauwe@gmail.com]
Sent: Sunday, October 21, 2007 10:28 AM
To: Maven Users List
Subject: Re: Junit 4 or TestNG 5 suite support

I don't understand either why surefire is not top-priority for the maven
devs to have everthing working that JUnit and TestNG support. Especially
since testing is part of the default lifecycle.

regards,

Wim


2007/10/19, Joel Wiegman <Jo...@btservices.com>:
>
> Thanks for the response Patrick.
>
> I'm not having problems using Junit 4 (I'm actually using Surefire 
> version 2.4-collab-SNAPSHOT because 2.4-SNAPSHOT is still broken).
>
> Just having problems getting any of the suite functionality to work.
> Frustrating...
>
> -----Original Message-----
> From: Patrick He [mailto:patrick.he@gmail.com]
> Sent: Thursday, October 18, 2007 11:10 PM
> To: Maven Users List
> Subject: Re: Junit 4 or TestNG 5 suite support
>
> Hello Joel Wiegman,
>
> You can put below lines in your pom.xml for supporting JUnit 4.
>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.3</version>
>             </plugin>
>         </plugins>
>     </build>
>
>
> Joel Wiegman wrote:
> > Members of the Maven council...
> >
> > Is Surefire's support for "suite" functionality limited to Junit 3?
> >
> > TestNG's @BeforeSuite and @AfterSuite annotations are not supported 
> > by
>
> > Surefire.
> >
> > Junit 4's equivalent to these methods are to set up a class as
> follows:
> >
> > @RunWith(value=Suite.class)
> > @SuiteClasses(value={MyFirstTest.class, AnotherTest.class}) public 
> > class AllTests {
> >
> >       @BeforeClass
> >       public void doStuffBeforeSuiteRuns() {
> >               ...
> >       }
> >
> >       @AfterClass
> >       public void doStuffAfterSuiteRuns() {
> >               ...
> >       }
> >
> >       @Test
> >       public void testMyStuff() {
> >               ...
> >       }
> >
> > }
> >
> > I then point Surefire to this class and it says no tests were found
> > (!!!) (and yes, it found the class).  Even the testMyStuff() method 
> > was not found as a test!
> >
> > Is there some matrix out there that shows what annotations are 
> > supported by Surefire?  Does anyone else out there have code running

> > before/after their suites with Junit 4 or TestNG 5?  Is my only 
> > option
>
> > here Junit 3 (frown)?
> >
> > Thanks so much!
> >
> > Joel
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
Blog: http://www.jroller.com/page/Fester

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Junit 4 or TestNG 5 suite support

Posted by Joel Wiegman <Jo...@btservices.com>.
Well, one reason could be that I haven't found a defect related to suite
support for either TestNG or Junit.

Does one exist already or is one needed?  I'm guessing they should be
separate defects? 

-----Original Message-----
From: Wim Deblauwe [mailto:wim.deblauwe@gmail.com] 
Sent: Sunday, October 21, 2007 10:28 AM
To: Maven Users List
Subject: Re: Junit 4 or TestNG 5 suite support

I don't understand either why surefire is not top-priority for the maven
devs to have everthing working that JUnit and TestNG support. Especially
since testing is part of the default lifecycle.

regards,

Wim


2007/10/19, Joel Wiegman <Jo...@btservices.com>:
>
> Thanks for the response Patrick.
>
> I'm not having problems using Junit 4 (I'm actually using Surefire 
> version 2.4-collab-SNAPSHOT because 2.4-SNAPSHOT is still broken).
>
> Just having problems getting any of the suite functionality to work.
> Frustrating...
>
> -----Original Message-----
> From: Patrick He [mailto:patrick.he@gmail.com]
> Sent: Thursday, October 18, 2007 11:10 PM
> To: Maven Users List
> Subject: Re: Junit 4 or TestNG 5 suite support
>
> Hello Joel Wiegman,
>
> You can put below lines in your pom.xml for supporting JUnit 4.
>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.3</version>
>             </plugin>
>         </plugins>
>     </build>
>
>
> Joel Wiegman wrote:
> > Members of the Maven council...
> >
> > Is Surefire's support for "suite" functionality limited to Junit 3?
> >
> > TestNG's @BeforeSuite and @AfterSuite annotations are not supported 
> > by
>
> > Surefire.
> >
> > Junit 4's equivalent to these methods are to set up a class as
> follows:
> >
> > @RunWith(value=Suite.class)
> > @SuiteClasses(value={MyFirstTest.class, AnotherTest.class}) public 
> > class AllTests {
> >
> >       @BeforeClass
> >       public void doStuffBeforeSuiteRuns() {
> >               ...
> >       }
> >
> >       @AfterClass
> >       public void doStuffAfterSuiteRuns() {
> >               ...
> >       }
> >
> >       @Test
> >       public void testMyStuff() {
> >               ...
> >       }
> >
> > }
> >
> > I then point Surefire to this class and it says no tests were found
> > (!!!) (and yes, it found the class).  Even the testMyStuff() method 
> > was not found as a test!
> >
> > Is there some matrix out there that shows what annotations are 
> > supported by Surefire?  Does anyone else out there have code running

> > before/after their suites with Junit 4 or TestNG 5?  Is my only 
> > option
>
> > here Junit 3 (frown)?
> >
> > Thanks so much!
> >
> > Joel
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
Blog: http://www.jroller.com/page/Fester

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Junit 4 or TestNG 5 suite support

Posted by TslH <ts...@gmail.com>.
Indeed.

It's worrying that this kind of messages still exist for more a year
that I follow that mailling-list, and keep unanswered.

Don't misunderstand my point of view: I'm not blaming someone. I'm
just underlying that there's a major problem in maven2, and this
problem has a name: Surefire.

We're all according on the point that testing is *THE* central
good-practise that everybody wants to adopt. How can we reach this
goal with maven if for each project, users have to deal with a
compatibility problem between surefire and its testing suit? How to
explain that users have to play with a magical combination of
snapshots to get their environment running? That's off-putting.

Now I think we have some questions to answer:

1) What's the problem we meet actually with surefire?
1.1) Does someone have an idea to solve it?
1.1.1) Is there some good-soul to apply and test these solutions?
1.2) Is there someone who really know well surefire and its way to work?

2) Does correcting surefire is the right answer?
3) A subtitute to surefire would be preferable?


Again, I don't want to blame someone, I just want to find a
(successful) exit to the current situation.

Tom.


2007/10/22, Arnaud HERITIER <ah...@gmail.com>:
> Good question ????
>
> Arnaud
>
> On 21/10/2007, Wim Deblauwe <wi...@gmail.com> wrote:
> >
> > I don't understand either why surefire is not top-priority for the maven
> > devs to have everthing working that JUnit and TestNG support. Especially
> > since testing is part of the default lifecycle.
> >
> > regards,
> >
> > Wim
> >
> >
> > 2007/10/19, Joel Wiegman <Jo...@btservices.com>:
> > >
> > > Thanks for the response Patrick.
> > >
> > > I'm not having problems using Junit 4 (I'm actually using Surefire
> > > version 2.4-collab-SNAPSHOT because 2.4-SNAPSHOT is still broken).
> > >
> > > Just having problems getting any of the suite functionality to work.
> > > Frustrating...
> > >
> > > -----Original Message-----
> > > From: Patrick He [mailto:patrick.he@gmail.com]
> > > Sent: Thursday, October 18, 2007 11:10 PM
> > > To: Maven Users List
> > > Subject: Re: Junit 4 or TestNG 5 suite support
> > >
> > > Hello Joel Wiegman,
> > >
> > > You can put below lines in your pom.xml for supporting JUnit 4.
> > >
> > >     <build>
> > >         <plugins>
> > >             <plugin>
> > >                 <artifactId>maven-surefire-plugin</artifactId>
> > >                 <version>2.3</version>
> > >             </plugin>
> > >         </plugins>
> > >     </build>
> > >
> > >
> > > Joel Wiegman wrote:
> > > > Members of the Maven council...
> > > >
> > > > Is Surefire's support for "suite" functionality limited to Junit 3?
> > > >
> > > > TestNG's @BeforeSuite and @AfterSuite annotations are not supported by
> > >
> > > > Surefire.
> > > >
> > > > Junit 4's equivalent to these methods are to set up a class as
> > > follows:
> > > >
> > > > @RunWith(value=Suite.class)
> > > > @SuiteClasses(value={MyFirstTest.class, AnotherTest.class}) public
> > > > class AllTests {
> > > >
> > > >       @BeforeClass
> > > >       public void doStuffBeforeSuiteRuns() {
> > > >               ...
> > > >       }
> > > >
> > > >       @AfterClass
> > > >       public void doStuffAfterSuiteRuns() {
> > > >               ...
> > > >       }
> > > >
> > > >       @Test
> > > >       public void testMyStuff() {
> > > >               ...
> > > >       }
> > > >
> > > > }
> > > >
> > > > I then point Surefire to this class and it says no tests were found
> > > > (!!!) (and yes, it found the class).  Even the testMyStuff() method
> > > > was not found as a test!
> > > >
> > > > Is there some matrix out there that shows what annotations are
> > > > supported by Surefire?  Does anyone else out there have code running
> > > > before/after their suites with Junit 4 or TestNG 5?  Is my only option
> > >
> > > > here Junit 3 (frown)?
> > > >
> > > > Thanks so much!
> > > >
> > > > Joel
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
> > Blog: http://www.jroller.com/page/Fester
> >
>
>
>
> --
> ..........................................................
> Arnaud HERITIER
> ..........................................................
> OCTO Technology - aheritier AT octo DOT com
> www.octo.com | blog.octo.com
> ..........................................................
> ASF - aheritier AT apache DOT org
> www.apache.org | maven.apache.org
> ...........................................................
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Junit 4 or TestNG 5 suite support

Posted by Arnaud HERITIER <ah...@gmail.com>.
Good question ????

Arnaud

On 21/10/2007, Wim Deblauwe <wi...@gmail.com> wrote:
>
> I don't understand either why surefire is not top-priority for the maven
> devs to have everthing working that JUnit and TestNG support. Especially
> since testing is part of the default lifecycle.
>
> regards,
>
> Wim
>
>
> 2007/10/19, Joel Wiegman <Jo...@btservices.com>:
> >
> > Thanks for the response Patrick.
> >
> > I'm not having problems using Junit 4 (I'm actually using Surefire
> > version 2.4-collab-SNAPSHOT because 2.4-SNAPSHOT is still broken).
> >
> > Just having problems getting any of the suite functionality to work.
> > Frustrating...
> >
> > -----Original Message-----
> > From: Patrick He [mailto:patrick.he@gmail.com]
> > Sent: Thursday, October 18, 2007 11:10 PM
> > To: Maven Users List
> > Subject: Re: Junit 4 or TestNG 5 suite support
> >
> > Hello Joel Wiegman,
> >
> > You can put below lines in your pom.xml for supporting JUnit 4.
> >
> >     <build>
> >         <plugins>
> >             <plugin>
> >                 <artifactId>maven-surefire-plugin</artifactId>
> >                 <version>2.3</version>
> >             </plugin>
> >         </plugins>
> >     </build>
> >
> >
> > Joel Wiegman wrote:
> > > Members of the Maven council...
> > >
> > > Is Surefire's support for "suite" functionality limited to Junit 3?
> > >
> > > TestNG's @BeforeSuite and @AfterSuite annotations are not supported by
> >
> > > Surefire.
> > >
> > > Junit 4's equivalent to these methods are to set up a class as
> > follows:
> > >
> > > @RunWith(value=Suite.class)
> > > @SuiteClasses(value={MyFirstTest.class, AnotherTest.class}) public
> > > class AllTests {
> > >
> > >       @BeforeClass
> > >       public void doStuffBeforeSuiteRuns() {
> > >               ...
> > >       }
> > >
> > >       @AfterClass
> > >       public void doStuffAfterSuiteRuns() {
> > >               ...
> > >       }
> > >
> > >       @Test
> > >       public void testMyStuff() {
> > >               ...
> > >       }
> > >
> > > }
> > >
> > > I then point Surefire to this class and it says no tests were found
> > > (!!!) (and yes, it found the class).  Even the testMyStuff() method
> > > was not found as a test!
> > >
> > > Is there some matrix out there that shows what annotations are
> > > supported by Surefire?  Does anyone else out there have code running
> > > before/after their suites with Junit 4 or TestNG 5?  Is my only option
> >
> > > here Junit 3 (frown)?
> > >
> > > Thanks so much!
> > >
> > > Joel
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
> Blog: http://www.jroller.com/page/Fester
>



-- 
..........................................................
Arnaud HERITIER
..........................................................
OCTO Technology - aheritier AT octo DOT com
www.octo.com | blog.octo.com
..........................................................
ASF - aheritier AT apache DOT org
www.apache.org | maven.apache.org
...........................................................

Re: Junit 4 or TestNG 5 suite support

Posted by Wim Deblauwe <wi...@gmail.com>.
I don't understand either why surefire is not top-priority for the maven
devs to have everthing working that JUnit and TestNG support. Especially
since testing is part of the default lifecycle.

regards,

Wim


2007/10/19, Joel Wiegman <Jo...@btservices.com>:
>
> Thanks for the response Patrick.
>
> I'm not having problems using Junit 4 (I'm actually using Surefire
> version 2.4-collab-SNAPSHOT because 2.4-SNAPSHOT is still broken).
>
> Just having problems getting any of the suite functionality to work.
> Frustrating...
>
> -----Original Message-----
> From: Patrick He [mailto:patrick.he@gmail.com]
> Sent: Thursday, October 18, 2007 11:10 PM
> To: Maven Users List
> Subject: Re: Junit 4 or TestNG 5 suite support
>
> Hello Joel Wiegman,
>
> You can put below lines in your pom.xml for supporting JUnit 4.
>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.3</version>
>             </plugin>
>         </plugins>
>     </build>
>
>
> Joel Wiegman wrote:
> > Members of the Maven council...
> >
> > Is Surefire's support for "suite" functionality limited to Junit 3?
> >
> > TestNG's @BeforeSuite and @AfterSuite annotations are not supported by
>
> > Surefire.
> >
> > Junit 4's equivalent to these methods are to set up a class as
> follows:
> >
> > @RunWith(value=Suite.class)
> > @SuiteClasses(value={MyFirstTest.class, AnotherTest.class}) public
> > class AllTests {
> >
> >       @BeforeClass
> >       public void doStuffBeforeSuiteRuns() {
> >               ...
> >       }
> >
> >       @AfterClass
> >       public void doStuffAfterSuiteRuns() {
> >               ...
> >       }
> >
> >       @Test
> >       public void testMyStuff() {
> >               ...
> >       }
> >
> > }
> >
> > I then point Surefire to this class and it says no tests were found
> > (!!!) (and yes, it found the class).  Even the testMyStuff() method
> > was not found as a test!
> >
> > Is there some matrix out there that shows what annotations are
> > supported by Surefire?  Does anyone else out there have code running
> > before/after their suites with Junit 4 or TestNG 5?  Is my only option
>
> > here Junit 3 (frown)?
> >
> > Thanks so much!
> >
> > Joel
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
Blog: http://www.jroller.com/page/Fester

RE: Junit 4 or TestNG 5 suite support

Posted by Joel Wiegman <Jo...@btservices.com>.
Thanks for the response Patrick.

I'm not having problems using Junit 4 (I'm actually using Surefire
version 2.4-collab-SNAPSHOT because 2.4-SNAPSHOT is still broken).

Just having problems getting any of the suite functionality to work.
Frustrating...

-----Original Message-----
From: Patrick He [mailto:patrick.he@gmail.com] 
Sent: Thursday, October 18, 2007 11:10 PM
To: Maven Users List
Subject: Re: Junit 4 or TestNG 5 suite support

Hello Joel Wiegman,

You can put below lines in your pom.xml for supporting JUnit 4.

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.3</version>
            </plugin>
        </plugins>
    </build>


Joel Wiegman wrote:
> Members of the Maven council...
>
> Is Surefire's support for "suite" functionality limited to Junit 3?
>
> TestNG's @BeforeSuite and @AfterSuite annotations are not supported by

> Surefire.
>
> Junit 4's equivalent to these methods are to set up a class as
follows:
>
> @RunWith(value=Suite.class)
> @SuiteClasses(value={MyFirstTest.class, AnotherTest.class}) public 
> class AllTests {
>
> 	@BeforeClass
> 	public void doStuffBeforeSuiteRuns() {
> 		...
> 	}
>
> 	@AfterClass
> 	public void doStuffAfterSuiteRuns() {
> 		...
> 	}
>
> 	@Test
> 	public void testMyStuff() {
> 		...
> 	}
>
> }
>
> I then point Surefire to this class and it says no tests were found
> (!!!) (and yes, it found the class).  Even the testMyStuff() method 
> was not found as a test!
>
> Is there some matrix out there that shows what annotations are 
> supported by Surefire?  Does anyone else out there have code running 
> before/after their suites with Junit 4 or TestNG 5?  Is my only option

> here Junit 3 (frown)?
>
> Thanks so much!
>
> Joel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Junit 4 or TestNG 5 suite support

Posted by Patrick He <pa...@gmail.com>.
Hello Joel Wiegman,

You can put below lines in your pom.xml for supporting JUnit 4.

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.3</version>
            </plugin>
        </plugins>
    </build>


Joel Wiegman wrote:
> Members of the Maven council...
>
> Is Surefire's support for "suite" functionality limited to Junit 3?
>
> TestNG's @BeforeSuite and @AfterSuite annotations are not supported by
> Surefire.
>
> Junit 4's equivalent to these methods are to set up a class as follows:
>
> @RunWith(value=Suite.class) 
> @SuiteClasses(value={MyFirstTest.class, AnotherTest.class})
> public class AllTests {
>
> 	@BeforeClass
> 	public void doStuffBeforeSuiteRuns() {
> 		...
> 	}
>
> 	@AfterClass
> 	public void doStuffAfterSuiteRuns() {
> 		...
> 	}
>
> 	@Test
> 	public void testMyStuff() {
> 		...
> 	}
>
> }
>
> I then point Surefire to this class and it says no tests were found
> (!!!) (and yes, it found the class).  Even the testMyStuff() method was
> not found as a test!
>
> Is there some matrix out there that shows what annotations are supported
> by Surefire?  Does anyone else out there have code running before/after
> their suites with Junit 4 or TestNG 5?  Is my only option here Junit 3
> (frown)?
>
> Thanks so much!
>
> Joel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org