Hi Team, Can you please help me how to fix below NullPointerException.
Moduel:TestNG And Data Driven Framework - LIVE PROJECT
video:9
Test case getting failed when i use below code for skipping Tests.
if(!DataUtil.isRunnable(testCaseName, xls)||data.get("Runmode").equals("N")){
test.log(LogStatus.SKIP, "Skipping the test as runmode is N");
throw new SkipException("Skipping the test as runmode is N");
}
Error:
java.lang.NullPointerException
at com.qtpselenium.zoho.project.util.DataUtil.isRunnable(DataUtil.java:62)
at com.qtpselenium.zoho.project.testcases.LoginTest.doLoginTest(LoginTest.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:597)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
Note:
it works good for skipping only test data
if(data.get("Runmode").equals("N")){
test.log(LogStatus.SKIP, "Skipping the test as runmode is N");
throw new SkipException("Skipping the test as runmode is N");
}
Instructor
Ashish Thakur Replied on 12/07/2020
at com.qtpselenium.zoho.project.util.DataUtil.isRunnable(DataUtil.java:62)
On line number 62 of data util some object is null