Reputation: 15
I am quite new to TestNG.
Following is my test method
@Test(dataProvider="getHRServiceData")
public void executeHRService(List<String> inputValues)
{
//some code here
}
As you can see this method requires List inputValues as argument.
Following is my code for getHRServiceData() method
public Object[][] getHRServiceData() throws Exception
{
List<String> inputValues=Utils.getInputDataFromExcelFileAsList("HR");
Object[][] objArray = new Object[inputValues.length][];
//Code to convert List<String> to Object[][]
}
In this method I get inputValues values in the form of List
But as return type is Object[][] I need to convert List into Object[][]
I am not sure how to convert List into Object[][]
Could you please help me here.
Upvotes: 1
Views: 5551
Reputation: 36304
Try something like this :
@DataProvider (name = "getHRServiceData")
public Object[][] getHRServiceData() {
return new Object[][] {
{
Utils.getInputDataFromExcelFileAsList("HR");
},
};
}
Upvotes: 2