Hi.
I have two questions:
1. I define @BeforeSuite and @AfterSuite defined in the same class. Is TestNG using the same instance of the class to invoke the methods, or does it create a new instance for them? The question is important because it will tell me whether I can store state in @BeforeSuite and reuse it later in @AfterSuite.
2. If I define more than one method with the same annotation, is any order guaranteed at runtime?
1. I define @BeforeSuite and @AfterSuite defined in the same class. Is TestNG using the same instance of the class to invoke the methods, or does it create a new instance for them? The question is important because it will tell me whether I can store state in @BeforeSuite and reuse it later in @AfterSuite.
It's not guaranteed so I wouldn't rely on that behavior.A safer way would be to store your data in an ITestContext attribute in @BeforeSuite and retrieve that value in @AfterSuite, let me know if you need more details about this.
2. If I define more than one method with the same annotation, is any order guaranteed at runtime?No. If you want guaranteed ordering, you should use dependencies.