Parameterization
- TestNg should be installed before execution.
- Runas>TestNg
package package_name;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class Parameter
{
@Test (dataProvider = "registerData")
public void SampleTest1A(String US,String Pass,String Id ,String name)
{
System.out.println(US+ "--"+Pass+ "--"+Id+ "--"+name);
}
@DataProvider
public Object[][] registerData()
{
Object[][] Data=new Object[3][4];//execute 3 Times , 4 Data Series taking 1 series each time
//Rows = No of times test should be repeated
//Columns = No of data
Data[0][0]="US1";
Data[0][1]="Pass1";
Data[0][2]="ID1";
Data[0][3]="Name1";
Data[1][0]="US2";
Data[1][1]="Pass2";
Data[1][2]="ID2";
Data[1][3]="Name2";
Data[2][0]="US3";
Data[2][1]="Pass3";
Data[2][2]="ID3";
Data[2][3]="Name3";
return Data;
}
}
No comments:
Post a Comment