Unable to run testcase

64 views
Skip to first unread message

shruthi v v

unread,
Nov 16, 2016, 6:01:16 AM11/16/16
to seleniu...@googlegroups.com
Hello Friends,

 Iam getting following error when I try to run my test project. I have not changed anything and it was working perfectly fine those days but not working now.

I appreciate any suggestions to solve this error and thanks in advance.

org.testng.TestNGException: 
Cannot instantiate class testng.login


My XML code here:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Test Suite">

<test name="Test">

<classes>

     <class name="testng.login">
      <methods>
        <include name="loginTest"/>
      </methods>
     </class>
 </classes> 
  
</test>
</suite> <!-- Suite -->

---------------------------------------------------------------------------------------------------------------
Console error here:

Starting ChromeDriver 2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed) on port 33634
Only local connections are allowed.
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
org.testng.TestNGException: 
Cannot instantiate class testng.login
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:40)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:373)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:285)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:126)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:191)
at org.testng.TestClass.getInstances(TestClass.java:104)
at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:90)
at org.testng.TestClass.init(TestClass.java:82)
at org.testng.TestClass.<init>(TestClass.java:45)
at org.testng.TestRunner.initMethods(TestRunner.java:422)
at org.testng.TestRunner.init(TestRunner.java:252)
at org.testng.TestRunner.init(TestRunner.java:222)
at org.testng.TestRunner.<init>(TestRunner.java:171)
at org.testng.remote.support.RemoteTestNG6_9_10$1.newTestRunner(RemoteTestNG6_9_10.java:28)
at org.testng.remote.support.RemoteTestNG6_9_10$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_9_10.java:61)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:604)
at org.testng.SuiteRunner.init(SuiteRunner.java:170)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:117)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1359)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1346)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1124)
at org.testng.TestNG.run(TestNG.java:1096)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 25 more
Caused by: java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:454)
at java.lang.Integer.parseInt(Integer.java:527)
at testng.readfile.getMyEnvironment(readfile.java:153)
at testng.readfile.<init>(readfile.java:68)
at testng.login.<init>(login.java:27)
... 30 more














Shruthi

⇜Krishnan Mahadevan⇝

unread,
Nov 16, 2016, 6:05:00 AM11/16/16
to Selenium Users
Have you paid attention to these lines ?
Caused by: java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:454)
at java.lang.Integer.parseInt(Integer.java:527)
at testng.readfile.getMyEnvironment(readfile.java:153)
at testng.readfile.<init>(readfile.java:68)
at testng.login.<init>(login.java:27)
... 30 more

and tried figuring out wherein your code are you giving in a non number and expecting java to parse it as a number ?





Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAERCCeOc2OknWBqFWWVJ5QdbwK7Rc7Od3WNz1SrWsZ4ALs9y6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

shruthi v v

unread,
Nov 16, 2016, 6:14:12 AM11/16/16
to seleniu...@googlegroups.com
Yeah, i just checked this.

I commented out that variable read line and working fine now.

Thank you Krishnan for the quick reply.














Shruthi

To post to this group, send email to seleniu...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages