"Cannot find class in classpath: classname" error in running testNG suite selenium-java-eclipse.

24,880 views
Skip to first unread message

Shailesh

unread,
Aug 1, 2009, 1:41:36 AM8/1/09
to selenium-users...@googlegroups.com
Hello,

I am using selenium rc-eclipse environment with testNG to create scripts in java.
I have created the testclasses of application which are individually running perfectly as testNG test.

When i am creating a suite(XML file which shown code below) for that testNg testclasses and running as testNG suite i am getting the above error in cosole of eclipse.

Error

===============================================\\ Suite1\\ Total tests run: 0, Failures: 0, Skips: 0\\ ===============================================

org.testng.TestNGException: \\ Cannot find class in classpath: Class1\\ &nbsp;&nbsp;&nbsp; at org.testng.xml.XmlClass.getSupportClass(XmlClass.java:55)\\ &nbsp;&nbsp;&nbsp; at org.testng.internal.Utils.xmlClassesToClasses(Utils.java:79)\\ &nbsp;&nbsp;&nbsp; at org.testng.TestRunner.initMethods(TestRunner.java:289)\\ &nbsp;&nbsp;&nbsp; at org.testng.TestRunner.init(TestRunner.java:235)\\ &nbsp;&nbsp;&nbsp; at org.testng.TestRunner.init(TestRunner.java:197)\\ &nbsp;&nbsp;&nbsp; at org.testng.TestRunner.<init>(TestRunner.java:155)\\ &nbsp;&nbsp;&nbsp; at org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:102)\\ &nbsp;&nbsp;&nbsp; at org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:154)\\ &nbsp;&nbsp;&nbsp; at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:529)\\ &nbsp;&nbsp;&nbsp; at org.testng.SuiteRunner.privateRun(SuiteRunner.java:250)\\ &nbsp;&nbsp;&nbsp; at org.testng.SuiteRunner.run(SuiteRunner.java:204)\\ &nbsp;&nbsp;&nbsp; at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877)\\ &nbsp;&nbsp;&nbsp; at org.testng.TestNG.runSuitesLocally(TestNG.java:842)\\ &nbsp;&nbsp;&nbsp; at org.testng.TestNG.run(TestNG.java:751)\\ &nbsp;&nbsp;&nbsp; at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)\\ &nbsp;&nbsp;&nbsp; at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)



TestNGSuite.xml :

<?xml version="1.0" encoding="UTF-8"?>\\ <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >\\ \\ <suite name="Suite1"&nbsp;&nbsp;&nbsp; verbose="1" >\\ &nbsp; <test name="Nopackage1" >\\ &nbsp;&nbsp;&nbsp; <classes>\\ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <class name="Class1"&nbsp; />\\ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <class name="Class2"&nbsp; />\\ &nbsp;&nbsp;&nbsp; </classes>\\ &nbsp; </test>\\ </suite>

Tarun

unread,
Aug 2, 2009, 11:49:47 PM8/2/09
to selenium-users...@googlegroups.com
Provide qualified names of your classes in testng.xml file. Right click on a class and say - Copy Qualified Name,

~ T

Shailesh

unread,
Aug 3, 2009, 3:33:19 AM8/3/09
to selenium-users...@googlegroups.com
It worked!!!!

Thank you Tarun for your great help!!!!!!

Shailesh

Ravindranath S

unread,
Jul 16, 2013, 1:53:45 AM7/16/13
to seleniu...@googlegroups.com, selenium-users...@googlegroups.com, clear...@openqa.org, shaile...@hotmail.com
Tarun/Sailesh ,

Am also getting same error. Where to paste the qualified Name ? 
Message has been deleted

Pham Duy An

unread,
Aug 26, 2016, 3:56:21 AM8/26/16
to Selenium Users, selenium-users...@googlegroups.com, clear...@openqa.org, shaile...@hotmail.com
Hi Shailesh,

I got the same error , as image link : http://prntscr.com/cal18n.
I try Copy Qualified Name and pass on xml file, but not working. Please help : http://prntscr.com/cal1nw 


Vào 14:33:19 UTC+7 Thứ Hai, ngày 03 tháng 8 năm 2009, Shailesh đã viết:

⇜Krishnan Mahadevan⇝

unread,
Aug 28, 2016, 5:02:12 AM8/28/16
to Selenium Users
Pham,

Your suite xml file contains the File system path of your test class. You should actually be providing the full qualified package name of the class.

So assuming that your class resides in the package "AutomationTest" and the java class name is "Login", you should be providing the class as "AutomationTest.Login"


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/7203507f-328f-4d6c-acbb-e5a756ac18a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages