You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gogirl <cl...@gmail.com> on 2012/02/21 00:25:20 UTC

known problem to get JUnit 4 and TestNG working together

In this article; Enda states that it’s a known problem to get JUnit 4 and
TestNG working together in a single maven build. 
http://enda.squarespace.com/testng-junit4-in-maven/

I have testng, junit 3.81 and junit 4.8.1. TestNG is stable. junit 3.81 ran
under both dependencies for junit 4.8.1. and 3.4.1, however it no longer
compiled when any junit 4.8.1. test code is added.  junit 4.8.1. test code
runs fine under 4.8.1. dependency but not under dependency 3.8.1.
Apparently, you can only have the 4.81 dependency.  

All my files run fine under the dos command line. To be honest I cannot
understand Enda's complicated solution. Does this warrant being reported as
a bug? Would anybody be willing to look at the code if i place it somewhere?
In its present state, it is pretty trivial and easy to reproduce.

--
View this message in context: http://maven.40175.n5.nabble.com/known-problem-to-get-JUnit-4-and-TestNG-working-together-tp5500597p5500597.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: known problem to get JUnit 4 and TestNG working together

Posted by Cedric Beust <ce...@beust.com>.
FYI, TestNG can run JUnit 4 tests as of last week :-)


--
View this message in context: http://maven.40175.n5.nabble.com/known-problem-to-get-JUnit-4-and-TestNG-working-together-tp5500597p5506835.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: known problem to get JUnit 4 and TestNG working together

Posted by Gogirl <cl...@gmail.com>.
Barrie, Kristian very useful replies. You guys all nailed it. I am the kind
of dog that would climb Mt Everest and won't let go of that bone if her life
depends on it. So I will hopefully have the wisdom to take your advise. With
that said, having worked with Maven for just 5 days, I wouldn't know that
the solution may be to place them in separate modules and need to be told. 

Kristian I find Cedric's opinions very refreshing and his work on TestNG
makes it my #1 choice as a java test framework. ScalaTest and Moquito are
sheer elegance imo. Let it suffice to say that I make it my business to know
my test frameworks but when it comes to Maven usage, I am the new kid in the
block.

Thank you for being gentle with me for side-tracking.

--
View this message in context: http://maven.40175.n5.nabble.com/known-problem-to-get-JUnit-4-and-TestNG-working-together-tp5500597p5501941.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: known problem to get JUnit 4 and TestNG working together

Posted by Kristian Rosenvold <kr...@gmail.com>.
Don't even bother filing an issue, at least not here.

JUnit4.X is not "compatible" with 3.8.1 in the sense that you can expect
to have both jars in the same maven module and expect them to "work".
JUnit 4.X can run JUnit 3 tests on itself though, so I think you can save
the calories if you're considering reporting to the JUnit project.

TestNG is compatible with JUnit 3.X, but not 4.X. Theorietically
you could waste half an hour nagging Cedric on some TestNG mailing
list about this. I would consider going for a walk in the sunshine instead.

But you can always run them in multiple-modules.

Kristian



2012/2/21 Gogirl <cl...@gmail.com>:
> In this article; Enda states that it’s a known problem to get JUnit 4 and
> TestNG working together in a single maven build.
> http://enda.squarespace.com/testng-junit4-in-maven/
>
> I have testng, junit 3.81 and junit 4.8.1. TestNG is stable. junit 3.81 ran
> under both dependencies for junit 4.8.1. and 3.4.1, however it no longer
> compiled when any junit 4.8.1. test code is added.  junit 4.8.1. test code
> runs fine under 4.8.1. dependency but not under dependency 3.8.1.
> Apparently, you can only have the 4.81 dependency.
>
> All my files run fine under the dos command line. To be honest I cannot
> understand Enda's complicated solution. Does this warrant being reported as
> a bug? Would anybody be willing to look at the code if i place it somewhere?
> In its present state, it is pretty trivial and easy to reproduce.
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/known-problem-to-get-JUnit-4-and-TestNG-working-together-tp5500597p5500597.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: known problem to get JUnit 4 and TestNG working together

Posted by Barrie Treloar <ba...@gmail.com>.
On Tue, Feb 21, 2012 at 2:51 PM, Wayne Fay <wa...@gmail.com> wrote:
>> I have testng, junit 3.81 and junit 4.8.1. TestNG is stable. junit 3.81 ran
>
> I have to ask, is this something you have an honest need for in a
> business scenario or are you simply trying to climb Mt. Everest
> because it is there? I do not regularly see a need to support more
> than one unit test framework in a project, and you're asking to
> support 3 at the same time.
>
>> All my files run fine under the dos command line. To be honest I cannot
>> understand Enda's complicated solution.
>
> I don't see it as a complication solution. He is simply making
> multiple invocations of Surefire and telling one to process the JUnit
> files while the other gets to process the TestNG files.

Alternatively, have three separate modules that house your unit tests
and keep the unit testing frameworks isolated.

p.s. Don't climb Mt Everest.

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


Re: known problem to get JUnit 4 and TestNG working together

Posted by Wayne Fay <wa...@gmail.com>.
> I have testng, junit 3.81 and junit 4.8.1. TestNG is stable. junit 3.81 ran

I have to ask, is this something you have an honest need for in a
business scenario or are you simply trying to climb Mt. Everest
because it is there? I do not regularly see a need to support more
than one unit test framework in a project, and you're asking to
support 3 at the same time.

> All my files run fine under the dos command line. To be honest I cannot
> understand Enda's complicated solution.

I don't see it as a complication solution. He is simply making
multiple invocations of Surefire and telling one to process the JUnit
files while the other gets to process the TestNG files.

> Does this warrant being reported as
> a bug?

If you think it is a bug, then feel free to post a JIRA. Just realize
that not all bugs will get the same level of attention by the dev
team. I see this as more of a feature request myself.

> Would anybody be willing to look at the code if i place it somewhere?
> In its present state, it is pretty trivial and easy to reproduce.

Recognize that you are dealing with open source projects (Maven,
JUnit, TestNG and Surefire) and that people around here scratch their
own itch. If this issue is a big problem for you, you will probably
need to hack the code yourself to support this use case and then
donate the code changes back for possible inclusion in a future
release.

Wayne

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