Any suggestions would be helpful Getting Error Java null pointer Exception on running the test

100 views Asked by At
  • I am getting the below error:

    [Utils] [ERROR] [Error] java.lang.NullPointerException

     at com.qa.FreeCRMPRO.Utils.ExcelUtil.getTestData(ExcelUtil.java:38)
     at com.qa.FreeCRMPRO.test.DealsPageTest.getEventInfo(DealsPageTest.java:96)
    
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    
  • This is the code which I am running

  • Test Page

    @DataProvider public Object[][] getEventInfo() { Object data[][] = ExcelUtil.getTestData(AppConstants.Add_Event_Sheet_Name); return data; }

    @Test(priority=6,dataProvider="getEventInfo") public void addEventDetails(String title,String calendervalue,String calender, String selectcalendervalue,String startdate,String enddate,String category, String description,String location,String deal,String alertbefore,String alertvia, String remindertime,String assignedto,String interval,String days,String enddates) { dealspage.EditEvent(title, calendervalue, calender, calendervalue,startdate, enddate,category,description,location,deal,alertbefore,alertvia, aA remindertime,assignedto,interval,days,enddates);
    }

Methods defined in Pages.Java Class

public void EditEvent(String title,String calender,String addnewcalender,String calender1,
        String startdates,String enddates,String catvalue,String desc,
        String loca,String dealsselection,String alertbefore,
        String alertviadrop,String remindtime,String assignedtoselect,String intervalvalue,
        String dayvalue, String seldate)
{  
    elementutils.waitforElementPresent(AddEventbutton);
    elementutils.doclick(AddEventbutton);
    elementutils.waitforElementPresent(eventtitle);
    elementutils.doSendKeys(eventtitle, title);
    elementutils.waitforElementPresent(Calenderdropdownclick);
    elementutils.doclick(Calenderdropdownclick);
    elementutils.selectvaluefromdropdown(calendervalueselection, calender);
    elementutils.waitforElementPresent(addnewCalenderName);
    elementutils.doSendKeys(addnewCalenderName, addnewcalender);
    elementutils.waitforclickingElement(savecalendername);
    elementutils.doclick(savecalendername);
    elementutils.selectvaluefromdropdown(calendervalueselection, calender1);
    elementutils.waitforclickingElement(Startdateclick);
    elementutils.clickonCalender(startdatecolumselection, startdates);
    elementutils.waitforElementPresent(enddateclick);
    elementutils.doclick(enddateclick);
    elementutils.waitforclickingElement(enddatecolumnselection);
    elementutils.clickonCalender(enddatecolumnselection, enddates);
    elementutils.waitforclickingElement(categoryEvent);
    elementutils.doclick(categoryEvent);    
    elementutils.selectvaluefromdropdown(categoryEventvalue, catvalue);     
    elementutils.waitforElementPresent(description);
    elementutils.doSendKeys(description, desc);
    elementutils.waitforElementPresent(location);
    elementutils.doSendKeys(location, loca);
    elementutils.waitforElementPresent(alldaytoggle);
    elementutils.doclick(alldaytoggle);
    elementutils.waitforclickingElement(DealSearchicon);
    elementutils.doclick(DealSearchicon);
    elementutils.selectvaluefromdropdown(dealsdropdownselection, dealsselection);
    elementutils.waitforElementPresent(Alertbefore);
    elementutils.doclick(Alertbefore);
    elementutils.selectvaluefromdropdown(Alertbeforevalue, alertbefore);
    elementutils.waitforElementPresent(Alertviadropdown);
    elementutils.doclick(Alertviadropdown);
    elementutils.selectvaluefromdropdown(Alertviadropdownvalue, alertviadrop);
    elementutils.waitforElementPresent(remindertime);
    elementutils.doSendKeys(remindertime, remindtime);
    elementutils.waitforElementPresent(Assignedto);
    elementutils.doclick(Assignedto);
    elementutils.selectvaluefromdropdown(Assignedtovalueselection, assignedtoselect);
    elementutils.waitforclickingElement(Recurrenceset);
    elementutils.doclick(Recurrenceset);
    elementutils.waitforElementPresent(intervaldropdownlick);
    elementutils.doclick(intervaldropdownlick);
    elementutils.selectvaluefromdropdown(intervalvalueselect, intervalvalue);
    elementutils.waitforElementPresent(days);
    elementutils.doclick(days);
    elementutils.selectvaluefromdropdown(daysvalueselect, dayvalue);
    elementutils.waitforElementPresent(Endat);
    elementutils.doclick(Endat);
    elementutils.waitforElementPresent(selectdate);
    elementutils.clickonCalender(selectdate, seldate);
    elementutils.waitforElementPresent(setbutton);
    elementutils.doclick(setbutton);
}

Excel Util shows a error in the below line -

data[i][k] = sheet.getRow(i+1).getCell(k).toString();
  • Can someone pls let me know where the issue lies?
0

There are 0 answers