In this particular project (web service test) I need to send email notifications to user after the user is authenticated. There are 2 APIs(endpoints) so, I have created two test classes. The first class AuthToken.java validates the user (here, i am using both @DataProvider and TestNG.Xml to pass user and API information). Here the method testAuthToken() returns a token upon success. The second class Notification.java needs the token from the first class.
I am using testng.xml to run my tests... something like this -
<classes><class name="AuthToken" /><class name="Notification" /></classes>
So, my question is how to share variables between two classes here? Is there any parameter or interface to do this.
I, checked http://testng.org/doc/documentation-main.html#dependent-methods, it says - "Any @AfterMethod method can declare a parameter of type ITestResult, which will reflect the result of the test method that was just run". But this is not clear to me and how to do this.
Can someone please help?