Open GoogleCodeExporter opened 9 years ago
This has happened to me under other conditions (ie. no other dev changed my
JARs),
but I haven't been able to nail down what those conditions are exactly, as the
issue
appears to occur randomly. One day I'll be able to run tests in Eclipse fine,
then
later that day, without any changes to my classpaths or anything, every test I
try
and run will get the dreaded "[ClassHelper] Could not instantiate ...". It's
REALLY
frustrating (and I wish I could provide more help in tracking the issue down,
but
unfortunately due to its sporadic nature I can't).
Original comment by machineg...@gmail.com
on 3 Apr 2009 at 12:21
P.S. I have found that when this issue occurs using Project => Clean and/or
restarting Eclipse can sometimes (but not always) resolve it. Perhaps you could
simply modify the plug-in such that when it runs and fails to find anything on
the
classpath, it does whatever cleaning/restarting Eclipse does
("behind-the-scenes"),
and then retries?
Original comment by machineg...@gmail.com
on 3 Apr 2009 at 12:27
Project => Clean worked for me too. Thanks!
Original comment by dfran...@gmail.com
on 20 Jun 2009 at 4:49
This happens in the following condition:
1. Your test case project is depending on other eclipse project ( could be
through
maven dependency)
2. The dependent project has build/compilation errors.
In this case, when you try to run the test case, maven eclipse plugin tries to
build
the dependent projects, and when it fails doing so, it stops building your
project,
and hence does not create class file for you test case.
Solution:
1.Close the other project, so that eclipse satisfies the project dependecy from
the
repository and not from the eclipse project.
2. Remove the build/compilation errors from the other project ( see the
problems view
for help)
Original comment by amjedonline@gmail.com
on 27 Oct 2009 at 9:27
That is not the only condition under which it happens. I just saw it happen
now when
I only had a single project open.
Original comment by machineg...@gmail.com
on 18 Dec 2009 at 11:30
Just figured out another thing that can cause this (and therefore another work
around). I had a build path error (that I found in the "Problems" tab) due to a
library that I'd specified in my project's build path, but which had since been
deleted in the file system. Once I removed this library from my build path, I
was
able to build (and see a bunch of other errors in my project), and it also made
it so
that I could actually run tests again. Hope this helps someone.
Original comment by machineg...@gmail.com
on 18 Dec 2009 at 11:41
[deleted comment]
I fixed this problem by re-installing the TestNG plugin, refreshing & cleaning
the build.
None of the solutions above worked for me before re-installing the plugin.
Hope it helps someone.
Original comment by Sereb...@gmail.com
on 2 Aug 2010 at 9:14
Got this problem because i had renamed the test file. And this new name was not
reflecting in the classpath of eclipse.
Tried all the above solutions but it didn't helped.
Fixed this problem by restarting the eclipse and then cleaning the project..
Original comment by tej...@google.com
on 19 Oct 2010 at 12:32
I had also this problem. For me worked rebuilding project with maven "clean
install" parameter, with Skip tests NOT cheched (so that tests are run before
build - they must be successfull otherwise it has no effect). After this, tests
started to work again properly.
Original comment by ondrej.s...@gmail.com
on 28 Oct 2010 at 9:32
for me it happened when I switched from one branch to another in git and forgot
to refresh the source tree
Original comment by ikara...@gmail.com
on 5 Nov 2010 at 9:13
We have had this same problem and it is intermittent here as well. There is a
simple, yet unexplainable fix. Open the .project file in an editor and remove
the line <nature>org.maven.ide.eclipse.maven2Nature</nature> from the <natures>
section. mvn eclipse:eclipse seems to, only sometimes, insert this line into
natures. When it does so, TESTNG exhibits this weird behavior. Good luck.
Original comment by jim.cl...@gmail.com
on 7 Dec 2010 at 3:54
Ugh. I tried all the above (which has in past worked), didn't work. What
worked this time was:
mvn eclipse:clean
mvn eclipse:eclipse
Then clean, then rebuild.
Original comment by dfran...@gmail.com
on 16 Feb 2011 at 6:06
Comment 6 was most applicable to me. As soon as I removed the missing jar from
the build path it worked a treat. The annoying thing in this situation, then,
was that the error message had no relation to the problem at hand.
Original comment by nathanan...@gmail.com
on 8 Mar 2011 at 9:56
Comment 13 worked for maven projects...
Original comment by aashish....@gmail.com
on 19 May 2011 at 5:26
Yep, "Project > Clean" worked for me. Frustrating morning till I found the
answer here. Thanks everyone.
Original comment by bitingsp...@gmail.com
on 3 Aug 2011 at 5:15
I had not qualified my class names in testng.xml with the package name, which
caused testng not to find them. Adding the package name solved it for me.
before: <class name="MyClass"/>
after: <class name="myPackage.MyClass"/>
Original comment by nor777...@gmail.com
on 3 Nov 2011 at 2:53
[deleted comment]
[deleted comment]
I had the same problem and the typo was same as comment#17. Adding my package
name worked for me!
class name="mypackage.myclass"
Original comment by doulat.k...@gmail.com
on 10 Nov 2011 at 10:53
If you have any other problems, please file a new issue on
http://github.com/cbeust/testng-eclipse.
Original comment by cbe...@gmail.com
on 10 Nov 2011 at 5:52
Nothing above worked for me.
I solved this issue by
>eclipe.rebuild.cmd
and from eclipse, did clean and rebuild.
Original comment by Syed.Bi...@gmail.com
on 12 Jan 2012 at 7:11
i am using testng 6.3.1, when i run the project i see message in console
org.testng.TestNGException:
Cannot instantiate class com.qait.testframework.Gale.AppTest
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:374)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:286)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:195)
at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
at org.testng.TestRunner.initMethods(TestRunner.java:405)
at org.testng.TestRunner.init(TestRunner.java:231)
at org.testng.TestRunner.init(TestRunner.java:201)
at org.testng.TestRunner.<init>(TestRunner.java:157)
at org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:139)
at org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:269)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:562)
at org.testng.SuiteRunner.init(SuiteRunner.java:157)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1216)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1203)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1057)
at org.testng.TestNG.run(TestNG.java:978)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 21 more
Caused by: java.lang.NoClassDefFoundError: com/google/common/base/Function
at com.qait.testframework.Gale.PageUI.<init>(PageUI.java:16)
at com.qait.testframework.Gale.AppTest.<init>(AppTest.java:12)
... 26 more
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 28 more
please suggest me which version of testng is best for me to reslove this....
Thanks
Abhishek Verma
Original comment by vietabhi...@gmail.com
on 15 Apr 2012 at 12:20
Hi,
i faced the same problem so many times. Sometimes as others mentioned by
closing the other projects and project-> Clean.
Since I am automating selenium in which I had the reference to excel sheet and
it was open for long time.Since I closed and opened eclipse maybe be some
reference is lost or not sure. It worked when I closed the excel sheet and
clean the project.
Original comment by shwethhh...@gmail.com
on 22 Aug 2012 at 9:08
I try above all comments but it doesn't help me.
Could any baddie have any other idea
Original comment by mangesh....@gmail.com
on 5 Nov 2012 at 4:40
It seems there is a problem regarding testng and maven, at least, for my case.
I tried to configure the project that it was failing to maven nature, and then
eclipse throws an error. Then I execute mvn eclipse:clean and mvn
eclipse:eclipse. And it starts to work, but it's a strange error.
I think it's not related to testng because some colleagues only use junit and
they have had the same problem.
I hope this helps you.
Original comment by sendamil...@gmail.com
on 13 Nov 2012 at 12:22
nothing above worked for me guys please help me
Original comment by fa...@provasolutions.com
on 26 Sep 2013 at 5:43
Hi guys,
I am facing same issue.Tried all above solutions but no luck
Original comment by manukeer...@gmail.com
on 15 Sep 2014 at 11:44
Cannot find class in classpath: com.slokam.wd.Example1
at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
at org.testng.xml.XmlClass.init(XmlClass.java:73)
at org.testng.xml.XmlClass.<init>(XmlClass.java:59)
at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:543)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.testng.xml.XMLParser.parse(XMLParser.java:39)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
at org.testng.xml.Parser.parse(Parser.java:168)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:17
in the first maven project i got the issue.Again i create a new maven project
add all dependecies. if i run the script got same problem...how can i rectify.
The issue is in my PC or eclipse
Original comment by sravan.g...@gmail.com
on 12 Oct 2014 at 7:34
How to solve the below error..
org.testng.TestNGException:
Cannot instantiate class Testcases
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:387)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:299)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:186)
at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
at org.testng.TestRunner.initMethods(TestRunner.java:409)
at org.testng.TestRunner.init(TestRunner.java:235)
at org.testng.TestRunner.init(TestRunner.java:205)
at org.testng.TestRunner.<init>(TestRunner.java:160)
at org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:141)
at org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:271)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:561)
at org.testng.SuiteRunner.init(SuiteRunner.java:157)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 21 more
Caused by: java.lang.NoClassDefFoundError:
org/openxmlformats/schemas/spreadsheetml/x2006/main/CTSheet
at Regression.Xlsx_Reader.<init>(Xlsx_Reader.java:61)
at Regression.Testcases.<init>(Testcases.java:15)
... 26 more
Caused by: java.lang.ClassNotFoundException:
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 28 more
Original comment by revathii...@gmail.com
on 6 Feb 2015 at 8:32
PLz help me out i stuck with below error
[TestNG] Running:
C:\Users\bharathk1\AppData\Local\Temp\testng-eclipse--545375835\testng-customsuite.xml
FAILED CONFIGURATION: @BeforeTest launchBrowser
java.lang.NullPointerException
at tests.my1st.launchBrowser(my1st.java:23)
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(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.TestRunner.beforeRun(TestRunner.java:641)
at org.testng.TestRunner.run(TestRunner.java:609)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
SKIPPED CONFIGURATION: @AfterTest closingBrowser
SKIPPED: verfyHomepageTitle
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 9 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@6b2d4a: 13 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@ac736f: 6 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@6f3b58: 65 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@ec6354: 39 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@1ee0005: 5 ms
Picked up _JAVA_OPTIONS: -Xmx512M
Original comment by anbukris...@gmail.com
on 24 Mar 2015 at 7:03
Original issue reported on code.google.com by
ralf.hau...@gmail.com
on 4 Feb 2009 at 5:38