Reputation: 90
I have a java class called DataReadHelper and i am creating a object of the mentioned class in my testng class
import DataReadHelper
public class testclass{
@BeforeSuite
public void initiate{
DataReadHelper dataread = new DataReadHelper("D:\\Test.xlsx");
}
Now i have a testng listener class which is implementing iTestResult listener and i want to verify whether the object for this class is created or not in the testng listener class
I have already tried many things but with no success, How can i achieve it? Thanks in advance for help
Upvotes: 0
Views: 217
Reputation: 5740
Yu can use ITestContext
in order to store the object:
@BeforeSuite
method and save your object into it: context.setAttribute("dataread", dataread)
DataReadHelper dataread = result.getTestContext().getAttribute("dataread")
Upvotes: 1