I realized that the actual order execution is : @BeforeClass @Test
My question to the TestNG developers :
Why not change the order execution to : @BeforeClass @Test @AfterTest @AfterClass
You received this message because you are subscribed to the Google Groups "testng-users" group.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
AW: [testng-users] Re: Strange order execution of @AfterClass combined with @AfterTest
Hi, this whole confusion might come from the reuse of the term “test” which means something very different in XML-suites and in Java respectively. I think a term like “test-case” would be more appropriate in the context of Java.
@Harmin: what you are behind is probably @BeforeMethod and @AfterMethod. Those are run just before and after every @Test-annotated method.
Regards Hubert Grzeskowiak
Von:[hidden email] [mailto:[hidden email]] Im Auftrag von Krishnan Mahadevan Gesendet: Dienstag, 21. Januar 2014 07:08 An:[hidden email] Betreff: Re: [testng-users] Re: Strange order execution of @AfterClass combined with @AfterTest
I still dont understand the rationale behind you feeling that its logical to inverse the order.
Why do you think that @AfterTest is supposed to be getting executed before @AfterClass
@AfterTest is designed to run after all the @Test annotated test methods that are part of a <test> have run to completion.
@AfterClass is designed to run after all the @Test annotated test methods that are part of a test class have run to completion.
A <test> can have one or more test classes.
So it only makes sense that @AfterClass run before and finally @AfterTest runs.