java.lang.NullPointerException + Test NG

<!DOCTYPE suite SYSTEM “” >

<suite name=”Idexx SmartService Enterprise” verbose=”10″ preserve-order=”true”>
<parameter name=”userName_Xml” value=”test1″/>
<parameter name=”password_Xml” value=”test1″/>
<parameter name=”transferFile_Xml” value=”Transfer File To Enterprise”/>
<parameter name=”advancedfileSearch_Xml” value=”Advanced File Search”/>
<parameter name=”infileshare_Xml” value=”IN_FILE_SHARE”/>

<test name=”IPU Advanced File Search Functionality”>
<parameter name=”practiceSAP_Xml” value=”123089″/>
<parameter name=”deviceSerialNo_Xml” value=”IPUDVPQJQ1″/>
<parameter name=”deviceId_Xml” value=”IPUDVPQJQ1″/>
<class name=”testng.filestab.AdvancedFileSearch_TestNG”/>
<test name=”IVLS Advanced File Search Functionality”>
<parameter name=”practiceSAP_Xml” value=”110606″/>
<parameter name=”deviceSerialNo_Xml” value=”VS582PY12″/>
<parameter name=”deviceId_Xml” value=”VS582PY12″/>
<class name=”testng.filestab.AdvancedFileSearch_TestNG”/>

When I run the above suite file, always only the last test tag is executed (here, test name=”IVLS Advanced File Search Functionality”), irrespective of how many test tags are present. I have debugged, I could not find the solution.

In output i get

at testng.filestab.AdvancedFileSearch_TestNG.LoginPage(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(
at org.testng.internal.Invoker.invokeMethod(
at org.testng.internal.Invoker.invokeTestMethod(
at org.testng.internal.Invoker.invokeTestMethods(
at org.testng.internal.TestMethodWorker.invokeTestMethods(
at org.testng.TestRunner.privateRun(
at org.testng.SuiteRunner.runTest(
at org.testng.SuiteRunner.runSequentially(
at org.testng.SuiteRunner.privateRun(
at org.testng.SuiteRunnerWorker.runSuite(
at org.testng.TestNG.runSuitesSequentially(
at org.testng.TestNG.runSuitesLocally(
at org.testng.remote.RemoteTestNG.initAndRun(
at org.testng.remote.RemoteTestNG.main(

Can you try giving an unique class name for each test.

Can you provide a snapshot of your project along with test file which the xml is referring to for a better view .

on August 11, 2015.
Add Comment
  • 1 Answer(s)

    Can you tell me what the code line on line 62 in . This is where you are getting null pointer.


    Professor Answered on August 13, 2015.


    on August 14, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.