I have created data in an excel sheet. I want data from two sheets (i.e Sheet1 and Sheet2)
So I have written two data providers as below. I have merged both dataproviders. But i'm getting Null pointer exception. I'm not sure why it is throwing null pointer exception.
@DataProvider
public Object[][] getStep1TestData()
{
Object data1[][]= TestUtil.getTestData(sheet1);
return data1;
}
@DataProvider
public Object[][] getStep2TestData()
{
Object data2[][]= TestUtil.getTestData(sheet2);// ---getting
null pointer exception return data2; }
@DataProvider
public Object mergeData()
{
List<Object[]> result = Lists.newArrayList();
result.addAll(Arrays.asList(getStep1TestData()));
result.addAll(Arrays.asList(getStep2TestData()));// ----getting null pointer exception here
return result.toArray(new Object[result.size()][]);
}
//@DataProvider
@Test(dataProvider="mergeData")
public void validateStep2Page(String customer, String customertype, String iscontractsigned, String productname,String productamount,String locationname,
String address1,String address2,String city, String state, String postalcode, String county, String country,
String daysofservices, String servicebranchcode, String csvbranchcode, String product, String quantity,
String changeorder) throws Exception
{
salescreatecontractstep1Page.Selectcustomer(customer, customertype, iscontractsigned, productname, productamount);
salescreatecontractstep2Page.addlocation(locationname, address1, address2, city, state, postalcode, county, country, daysofservices, servicebranchcode, csvbranchcode, product, quantity, changeorder);
}