It is very helpful to simplify the script by initializing the parameters that the constructor will use. It assigns external data to local variables, allowing the initialized parameters to be used by other methods. Directly on the code:
Private String URL;
Private String UserName;
Private String PassWord;
Private String ClientName;
Static String filepath= "D://project//tm.xlsx";
Static String Sheetname= "TM";
@Factory (dataprovider= "Tmdata")
Public taxonomylist (string URL, String userName, String PassWord, String clientName) {
This.url=url;
This.username=username;
This.password=password;
This.clientname=clientname;
}
The returned two-dimensional array will be used for each iteration
@DataProvider
public static object[][] Tmdata () throws exception{
Excelutils exutil=new excelutils ();
Object[][] Testdata=exutil.gettablearray (FilePath, sheetname);
return (TestData);
}
Using @factory and @dataprovider for parameterization