Re: Maven:test with Junit4
thanks to all your answers. Anders Hammar wrote: > > Also, when using JUnit 4, your test class should NOT extend from any JUnit > class as was the case in JUnit 3. I remember a very tricky issue on this > mailing list a year or so ago, where someone used JUnit 4 style > annotations > but the tests weren't run. The reason was that the test class extended > JUnit > 3's TestCase class. > As Junit 4 is backwards compatible, it would compile. But it wouldn't run > with the surefire plugin in Maven. > > /Anders > > On Wed, May 26, 2010 at 14:50, Nicola Musatti > wrote: > >> Specifying a dependency to junit-4.8.1.jar with test scope works for me, >> as >> in: >> >> >> junit >> junit >> 4.8.1 >> test >> >> >> Cheers, >> Nicola Musatti >> >> >> MartyMcFly wrote: >> >>> Hi, >>> >>> I do have problems running Junit4 Tests with Maven surefire. >>> >>> Apparently it only recognizes JUnit3 testcases. So @Test or @Before >>> annotated methods are ignored. Only if they follow the Junit3 style they >>> are >>> run. >>> >>> I have junit-dep.4.7.jar as dependencies, the tests are in src/test/java >>> and >>> running in Eclipse via "Run As" -> "Junit Tests" work fine. >>> >>> The surefire plugin is version 2.4.3 >>> >>> Is there any way to tell surefire to run with Junit 4 ? >>> >>> Thanks >>> >>> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > > -- View this message in context: http://old.nabble.com/Maven%3Atest-with-Junit4-tp28679295p28690094.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven:test with Junit4
Also, when using JUnit 4, your test class should NOT extend from any JUnit class as was the case in JUnit 3. I remember a very tricky issue on this mailing list a year or so ago, where someone used JUnit 4 style annotations but the tests weren't run. The reason was that the test class extended JUnit 3's TestCase class. As Junit 4 is backwards compatible, it would compile. But it wouldn't run with the surefire plugin in Maven. /Anders On Wed, May 26, 2010 at 14:50, Nicola Musatti wrote: > Specifying a dependency to junit-4.8.1.jar with test scope works for me, as > in: > > > junit > junit > 4.8.1 > test > > > Cheers, > Nicola Musatti > > > MartyMcFly wrote: > >> Hi, >> >> I do have problems running Junit4 Tests with Maven surefire. >> >> Apparently it only recognizes JUnit3 testcases. So @Test or @Before >> annotated methods are ignored. Only if they follow the Junit3 style they >> are >> run. >> >> I have junit-dep.4.7.jar as dependencies, the tests are in src/test/java >> and >> running in Eclipse via "Run As" -> "Junit Tests" work fine. >> >> The surefire plugin is version 2.4.3 >> >> Is there any way to tell surefire to run with Junit 4 ? >> >> Thanks >> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: Maven:test with Junit4
Specifying a dependency to junit-4.8.1.jar with test scope works for me, as in: junit junit 4.8.1 test Cheers, Nicola Musatti MartyMcFly wrote: Hi, I do have problems running Junit4 Tests with Maven surefire. Apparently it only recognizes JUnit3 testcases. So @Test or @Before annotated methods are ignored. Only if they follow the Junit3 style they are run. I have junit-dep.4.7.jar as dependencies, the tests are in src/test/java and running in Eclipse via "Run As" -> "Junit Tests" work fine. The surefire plugin is version 2.4.3 Is there any way to tell surefire to run with Junit 4 ? Thanks - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven:test with Junit4
ok.. I found http://old.nabble.com/JUnit-4-%40Before-ts13911963.html#a13912218 that junit-dep does not trigger the JUnit4 Runner in surefire. But as this is over 2 years old now - I'm wondering whether und why this is still doing so ?! MartyMcFly wrote: > > Hi, > > I do have problems running Junit4 Tests with Maven surefire. > > Apparently it only recognizes JUnit3 testcases. So @Test or @Before > annotated methods are ignored. Only if they follow the Junit3 style they > are run. > > I have junit-dep.4.7.jar as dependencies, the tests are in src/test/java > and running in Eclipse via "Run As" -> "Junit Tests" work fine. > > The surefire plugin is version 2.4.3 > > Is there any way to tell surefire to run with Junit 4 ? > > Thanks > -- View this message in context: http://old.nabble.com/Maven%3Atest-with-Junit4-tp28679295p28679322.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Maven:test with Junit4
Hi, I do have problems running Junit4 Tests with Maven surefire. Apparently it only recognizes JUnit3 testcases. So @Test or @Before annotated methods are ignored. Only if they follow the Junit3 style they are run. I have junit-dep.4.7.jar as dependencies, the tests are in src/test/java and running in Eclipse via "Run As" -> "Junit Tests" work fine. The surefire plugin is version 2.4.3 Is there any way to tell surefire to run with Junit 4 ? Thanks -- View this message in context: http://old.nabble.com/Maven%3Atest-with-Junit4-tp28679295p28679295.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org