I am trying to run a parameterized test in testNg using dataProvider. But somehow it is always ignoring that test case. Below is the reference code:
@DataProvider(name = "test")
public Object[][] testDP() throws Exception {
Object[][] arrayObject = getExcelData("TestData.xlsx", "TestData", "testName");
return arrayObject;
}
@Test(dataProvider = "test", groups = {"sanity"})
public void testMethod(String testName, String logisticsHandler) {
System.out.print(testName + "\n");
setUpdateLogisticsHandler(logisticsHandler);
updateLogisticsHandler(context.getAuthToken(),context.getQuoteIdForRfq());
}
There are two ways of sending data to the test.
For Example: String testName, String logisticsHandler are two fields in your @test function then the excel must have ONLY two rows with the required fields testdata so that the ObjectArray will have these fields.
You can use Apache POI and handle this very easily.