--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
When you extend classes containing TestNG annotations, your sub-class
effectively inherits those as well. Cédric is correct, by failing in a
@BeforeClass configuration defined in your super-class, you will by
definition of a @Before_____ method skip all tests.
I would recommend defining your @Before____ methods with a higher
level of granularity using groups / dependsOnGroups to chain your
@BeforeClass methods if you need to. This can even happen across
class bounds (ie: a BeforeClass method in the sub class can depend on
a BeforeClass method in a super class). Thus, you can define more
classes in your hierarchy that have higher or lower precondition
levels for your tests to then inherit.
In you example, all tests are being skipped because the same
@BeforeClass configuration method fails for each test, this is what
you want!
> <wujek.sru...@googlemail.com>wrote:
> >>> testng-users...@googlegroups.com<testng-users%2Bunsubscribe@google groups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/testng-users?hl=en.
>
> >> --
> >> ***Cédric
> >> *
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "testng-users" group.
> >> To post to this group, send email to testng...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> testng-users...@googlegroups.com<testng-users%2Bunsubscribe@google groups.com>
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
I'd love to have the strict=true (or whatever it would be called) flag
added to the @BeforeMethod and particularity the @AfterMethod. We've
changed the TestNG code to continue to run tests if an @AfterMethod
method fails. (This was only a few lines of code.) But I hate being
on my own version and having to deal with porting my change to newer
versions. This seems really about scope. The discussion so far has
been about reducing the scope of @BeforeClass to just an instance
(which I am in favor of). I want the scope of @XXXMethod reduced to
just a single method, which seems reasonable and consistent with
TestNG behavior. Since that is not how it currently works, a flag
like you purpose could also apply to @XXXMethod.
Here are links to issues and discussions that a flag like this could
resolve, starting with the one that affects me the most.
Add support for verify methods running after test methods
http://jira.opensymphony.com/browse/TESTNG-145
Single Failure in Inherited BeforeMethod Causes All Subsequent
Invocations to be Skipped
http://groups.google.com/group/testng-users/browse_thread/thread/4b5d81fa2c3af24a
A @BeforeMethod failure skips all remaining tests in sibling instances
generated by an @Factory.
http://jira.opensymphony.com/browse/TESTNG-202
Thanks for your consideration,
-John
> <wujek.sru...@googlemail.com>wrote:
> >>>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/testng-users?hl=en.
>
> >>> --
> >>> ***Cédric
> >>> *
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "testng-users" group.
> >>> To post to this group, send email to testng...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> testng-users...@googlegroups.com<testng-users%2Bunsu...@googlegroups.com>
> >>> .
> >>> For more options, visit this
>
> ...
>
> read more »
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
Sure. You can find the aftermethod.patch patch file attached to
TESTNG-145:
http://jira.opensymphony.com/browse/TESTNG-145
I believe the patch is intended for TestNG 5.7. We're using it with
5.8, though I recall applying it by hand. The patch was supplied by
Dan Fabulich.
-John
On Feb 24, 3:07 am, neotrumat...@gmail.com wrote:
> Hello John,
>
> Could you be kind enough to elaborate on this?
> "We've changed the TestNG code to continue to run tests if an @AfterMethod
> method fails. (This was only a few lines of code.)"
>
> Thanks,
> Neo
>
> On Wed, Feb 24, 2010 at 03:08, Jek <john.m.sm...@attachmate.com> wrote:
> > Hi Cedric,
>
> > I'd love to have the strict=true (or whatever it would be called) flag
> > added to the @BeforeMethod and particularity the @AfterMethod. We've
> > changed the TestNG code to continue to run tests if an @AfterMethod
> > method fails. (This was only a few lines of code.) But I hate being
> > on my own version and having to deal with porting my change to newer
> > versions. This seems really about scope. The discussion so far has
> > been about reducing the scope of @BeforeClass to just an instance
> > (which I am in favor of). I want the scope of @XXXMethod reduced to
> > just a single method, which seems reasonable and consistent with
> > TestNG behavior. Since that is not how it currently works, a flag
> > like you purpose could also apply to @XXXMethod.
>
> > Here are links to issues and discussions that a flag like this could
> > resolve, starting with the one that affects me the most.
>
> > Add support for verify methods running after test methods
> >http://jira.opensymphony.com/browse/TESTNG-145
>
> > Single Failure in Inherited BeforeMethod Causes All Subsequent
> > Invocations to be Skipped
>
> >http://groups.google.com/group/testng-users/browse_thread/thread/4b5d...
> ...
>
> read more »
Ben,
Have you given this one more try?
I cant seem to reproduce this using the latest version of TestNG 6.11.
If you are still facing this problem, I would suggest that you please help create a sample that can be used to reproduce the issue and share that with us.
package com.rationaleemotions.googleforums.common;
import org.testng.annotations.BeforeClass;
public class AbstractTest {
@BeforeClass
public void beforeAbstractTestClass() {
System.out.println("<<<<<>>>>> AbstractTest.beforeAbstractTestClass() for class " + getClass().getName());
throw new RuntimeException("just testing stuff");
}
}
import org.testng.annotations.Test;
public class TestOne extends AbstractTest {
@Test
public void test() {
System.out.println("<<<<<>>>>> TestOne.test()");
}
}
import org.testng.annotations.Test;
public class TestTwo extends AbstractTest {
@Test
public void test() {
System.out.println("<<<<<>>>>> TestTwo.test()");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Common_Suite" parallel="classes" verbose="2" >
<test name="Common_Test">
<classes>
<class name="com.rationaleemotions.googleforums.common.TestOne"/>
<class name="com.rationaleemotions.googleforums.common.TestTwo"/>
</classes>
</test>
</suite>
T E S T S
-------------------------------------------------------
Running TestSuite
...
... TestNG 6.11 by Cédric Beust (ced...@beust.com)
...
<<<<<>>>>> AbstractTest.beforeAbstractTestClass() for class com.rationaleemotions.googleforums.common.TestTwo
<<<<<>>>>> AbstractTest.beforeAbstractTestClass() for class com.rationaleemotions.googleforums.common.TestOne
Tests run: 4, Failures: 2, Errors: 0, Skipped: 2, Time elapsed: 0.338 sec <<< FAILURE! - in TestSuite
beforeAbstractTestClass(com.rationaleemotions.googleforums.common.TestOne) Time elapsed: 0.231 sec <<< FAILURE!
java.lang.RuntimeException: just testing stuff
beforeAbstractTestClass(com.rationaleemotions.googleforums.common.TestTwo) Time elapsed: 0.231 sec <<< FAILURE!
java.lang.RuntimeException: just testing stuff
Results :
Failed tests:
TestOne>AbstractTest.beforeAbstractTestClass:9 » Runtime just testing stuff
TestTwo>AbstractTest.beforeAbstractTestClass:9 » Runtime just testing stuff
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.