[infinispan-dev] usage of alwaysRun=true on @BeforeMethod and alike

Dan Berindei dan.berindei at gmail.com
Thu May 9 12:33:05 EDT 2013


On Thu, May 9, 2013 at 2:23 PM, Mircea Markus <mmarkus at redhat.com> wrote:

>
> On 9 May 2013, at 08:02, Dan Berindei wrote:
>
> > Why would TestNG run an @AfterMethod method if the test didn't run?
> if you set alwaysRun=true on that method it will run it disregarding if
> the test was run or not.
> > What method would it run after?
> not sure i get the question.
>
>
A test method is "skipped" only if a dependency of the test failed (e.g. a
@BeforeMethod method). A test that's in a different group may be considered
"ignored" or "disabled", but it's not "skipped". Since TestNG is not even
trying to run the method, it shouldn't run any @BeforeMethod/@AfterMethod
methods for it either.

I wrote a test class with different groups for the test method and each
confguration method, and the only configuration methods that ran even with
no test method in the default group were @BeforeTest/@AfterTest.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20130509/65f039bf/attachment.html 


More information about the infinispan-dev mailing list