Using @factory and @dataprovider for parameterization

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.