Significance of alwaysRun=true

774 views
Skip to first unread message

Anoop

unread,
Feb 15, 2010, 4:57:52 AM2/15/10
to testng-users
Can someone please explain what is the significance of marking a
@Before* and @After* method as alwaysRun=true?

-Anoop

Cédric Beust ♔

unread,
Feb 15, 2010, 9:33:57 AM2/15/10
to testng...@googlegroups.com
Hi Anoop,

Here is the documentation:

For before methods (beforeSuite, beforeTest, beforeTestClass and beforeTestMethod, but not beforeGroups): If set to true, this configuration method will be run regardless of what groups it belongs to.
For after methods (afterSuite, afterClass, ...): If set to true, this configuration method will be run even if one or more methods invoked previously failed or was skipped.

Is this clear enough?

--
Cedric



--
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.




--
Cédric


Anoop

unread,
Feb 15, 2010, 10:53:35 PM2/15/10
to testng-users
Thanks Cedric.

I had seen the documentation. But I guess I interpreted it wrong.

I have defined two groups - "A" and "B" within a test class and also a
@BeforeClass method that I had marked as alwaysRun=true. If I invoke
the test with a non-existent group name "XYZ" I see that the
@BeforeClass is not getting invoked. Is this the expected behavior?

-Anoop

On Feb 15, 7:33 pm, Cédric Beust ♔ <cbe...@google.com> wrote:
> Hi Anoop,
>
> Here is the documentation:
>
> For before methods (beforeSuite, beforeTest, beforeTestClass and
> beforeTestMethod, but not beforeGroups): If set to true, this configuration
> method will be run regardless of what groups it belongs to.
> For after methods (afterSuite, afterClass, ...): If set to true, this
> configuration method will be run even if one or more methods invoked
> previously failed or was skipped.
>
> Is this clear enough?
>
> --
> Cedric
>
>
>
> On Mon, Feb 15, 2010 at 1:57 AM, Anoop <anoopengin...@gmail.com> wrote:
> > Can someone please explain what is the significance of marking a
> > @Before* and @After* method as alwaysRun=true?
>
> > -Anoop
>
> > --
> > 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 group at
> >http://groups.google.com/group/testng-users?hl=en.
>
> --

> ***Cédric
> *

neotru...@gmail.com

unread,
Feb 16, 2010, 12:40:38 AM2/16/10
to testng...@googlegroups.com
Hey Anoop,
 
Since there are no test methods that match the group selection in the test class, it is completely ignored. I think it is the expected behavior.
Regards,
Neo
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages