Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
471 views
in Technique[技术] by (71.8m points)

java - Unable to read methods on class - TestNG

I have created a simple selenium project(not maven) using testng framework and trying to integrate it with Jenkins. While running the testrunner.bat file through Jenkins, it gives me below warning on console and not able to execute my test cases.

C:UsersShipra Parihar estMavenProjectTest_Automation_Framework>testrunner.bat

C:UsersShipra Parihar estMavenProjectTest_Automation_Framework>java -cp bin;lib/* org.testng.TestNG testng.xml [TestNGClassFinder] Warning: Can't link and determine methods of class com.qa.tests.LoginTest [[TestNGClassFinder]] Unable to read methods on class com.qa.tests.LoginTest - unable to resolve class reference org/openqa/selenium/WebDriver [TestNGClassFinder] Warning: Can't link and determine methods of class com.qa.tests.SearchTest [[TestNGClassFinder]] Unable to read methods on class com.qa.tests.SearchTest - unable to resolve class reference org/openqa/selenium/WebDriver [TestNGClassFinder] Warning: Can't link and determine methods of class com.qa.tests.ListingPageTest [[TestNGClassFinder]] Unable to read methods on class com.qa.tests.ListingPageTest - unable to resolve class reference org/openqa/selenium/WebDriver [TestNGClassFinder] Warning: Can't link and determine methods of class com.qa.tests.DetailpageTest [[TestNGClassFinder]] Unable to read methods on class com.qa.tests.DetailpageTest - unable to resolve class reference org/openqa/selenium/WebDriver [TestNGClassFinder] Warning: Can't link and determine methods of class com.qa.tests.PaymentpageTest [[TestNGClassFinder]] Unable to read methods on class com.qa.tests.PaymentpageTest - unable to resolve class reference org/openqa/selenium/WebDriver [TestNG] Running: C:UsersShipra Parihar estMavenProjectTest_Automation_Framework estng.xml

=============================================== Suite

Total tests run: 0, Failures: 0, Skips: 0

Please provide me solution.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I faced the same problem and this is the way I solved it. I put all the .jar file I need to a folder and add to build path of project. Then I run the following command line:

java -cp "[compile folder]";"[JAR folder]*" org.testng.TestNG [xml file]

For example

java -cp "D:AutomationsSeleniumWorkspaceSimpleTestin";"D:AutomationsSeleniumWorkspaceSimpleTestJAR File*" org.testng.TestNG runTest.xml

Hope it helpful for you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...