@BeforeMethod + alwaysRun=true is indeed pretty wrong and pointless in
relation to groups but @AfterMethod + alwaysRun=true seems to make sense
given this bit of javadoc: "If set to true, this configuration method
will be run even if one or more methods invoked previously failed or was
skipped". Does this imply our precious teardown method will be skipped
because the test failed unless we add alwaysRun=true?
On 05/08/2013 06:36 PM, Mircea Markus wrote:
This makes the invocation of that method happen even if the test is
not in the running
group:http://testng.org/javadoc/org/testng/annotations/BeforeMethod.html#...
E.g. if I want to run the "xsite" groups, all the @AfterMethod(alwaysRun=true)
from the "functional" groups are also invoked, most likely causing NPEs as the
resources from this tests haven't been initialised. So unless used for an abstract
test class that would be extended by multiple classes from different groups, I don't
see any point in using "alwaysRun" on neither @BeforeMethod nor on
@AfterMethod.
Cheers,