You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-dev@maven.apache.org by Cédric Beust ♔ <cb...@google.com> on 2008/02/07 00:04:40 UTC
Re: [testng-users] testng, surefire, and forkMode=always
Creating a TestNG instance for every @Test method? Seems completely useless
to me.
Especially when you can control the threading behavior with the parallel
attribute.
--
Cédric
On Wed, Feb 6, 2008 at 2:59 PM, Dan Fabulich <da...@fabulich.com> wrote:
>
>
> Benjamin Bentmann has filed bug SUREFIRE-446
> http://jira.codehaus.org/browse/SUREFIRE-446
>
> Maven Surefire provides a facility for various "fork modes":
>
> * forkMode=once: The default mode, spawns a separate TestNG process (like
> the TestNG Ant task)
>
> * forkMode=never: run TestNG in the same process as Maven, in an isolated
> classloader
>
> * forkMode=always: launch TestNG N times for N tests; if one test
> segfaults or calls System.exit or something, the other tests can run to
> completion safely.
>
> I didn't test forkMode=always with TestNG in Surefire 2.4, and sure enough
> it doesn't work at all. (It runs the tests but reports 0 tests
> passed/failed.)
>
> It does work basically OK for JUnit, where classes are normally isolated
> from each other, but I'm not sure it even makes sense for TestNG tests,
> where one test may depend on tests in other classes (multi-class dependent
> methods).
>
> I can kind of hack it so it works OK if you don't have multi-class
> dependent methods, but if you DO have multi-class dependent methods, it
> fails with a TestNGException: "MyTest.testFoo() is depending on
> nonexistent method otherClassSetUp".
>
> What should I do here? Put in the hack and let the user figure out the
> TestNGException if they try to use multi-class dependent methods? Fail
> with a clean error if the user tries to use forkMode=always with TestNG?
> Something else?
>
> Should forkMode=always be a feature of TestNG somehow?
>
> -Dan
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng-users@googlegroups.com
> To unsubscribe from this group, send email to
> testng-users-unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
Re: [testng-users] Re: testng, surefire, and forkMode=always
Posted by Dan Fabulich <da...@fabulich.com>.
Cédric Beust ♔ wrote:
> Creating a TestNG instance for every @Test method? Seems completely useless
> to me.
No, once for every test class.
> Especially when you can control the threading behavior with the parallel
> attribute.
Well, the point is crash protection, not threading. (Also, Benjamin would
like to keep separate XML files for every class, separate stdout files for
every class, etc.)
-Dan
Re: [testng-users] testng, surefire, and forkMode=always
Posted by Benjamin Bentmann <be...@udo.edu>.
Cédric Beust ♔ wrote:
>
> Creating a TestNG instance for every @Test method? Seems completely
> useless
> to me.
>
The intent is not to fork once per test method but once per test class. Just
like I can say in the TestNG Eclipse plugin "run class XY" instead of
selecting a group.
Benjamin Bentmann
--
View this message in context: http://www.nabble.com/testng%2C-surefire%2C-and-forkMode%3Dalways-tp15323782p15324537.html
Sent from the Surefire - Developer mailing list archive at Nabble.com.