本文介绍了无法读取类别上的方法-TestNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用testng框架创建了一个简单的硒项目(不是maven),并尝试将其与Jenkins集成.通过Jenkins运行testrunner.bat文件时,它在控制台上给了我以下警告,并且无法执行我的测试用例.

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:\ Users \ Shipra Parihar \ testMavenProject \ Test_Automation_Framework> testrunner.bat

C:\Users\Shipra Parihar\testMavenProject\Test_Automation_Framework>testrunner.bat

C:\ Users \ Shipra Parihar \ testMavenProject \ Test_Automation_Framework> java -cp bin; lib/* org.testng.TestNG testng.xml[TestNGClassFinder]警告:无法链接和确定com.qa.tests.LoginTest类的方法[[TestNGClassFinder]]无法读取com.qa.tests.LoginTest类上的方法-无法解析类引用org/openqa/selenium/WebDriver[TestNGClassFinder]警告:无法链接和确定com.qa.tests.SearchTest类的方法[[TestNGClassFinder]]无法读取com.qa.tests.SearchTest类上的方法-无法解析类引用org/openqa/selenium/WebDriver[TestNGClassFinder]警告:无法链接和确定com.qa.tests.ListingPageTest类的方法[[TestNGClassFinder]]无法读取com.qa.tests.ListingPageTest类上的方法-无法解析类引用org/openqa/selenium/WebDriver[TestNGClassFinder]警告:无法链接和确定com.qa.tests.DetailpageTest类的方法[[TestNGClassFinder]]无法读取com.qa.tests.DetailpageTest类上的方法-无法解析类引用org/openqa/selenium/WebDriver[TestNGClassFinder]警告:无法链接和确定com.qa.tests.PaymentpageTest类的方法[[TestNGClassFinder]]无法读取com.qa.tests.PaymentpageTest类上的方法-无法解析类引用org/openqa/selenium/WebDriver[TestNG]正在运行: C:\ Users \ Shipra Parihar \ testMavenProject \ Test_Automation_Framework \ testng.xml

C:\Users\Shipra Parihar\testMavenProject\Test_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:\Users\Shipra Parihar\testMavenProject\Test_Automation_Framework\testng.xml

================================================套房

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

请为我提供解决方案.

推荐答案

我遇到了同样的问题,这就是我解决问题的方法.我将所有需要的.jar文件放到一个文件夹中,并添加到项目的构建路径中.然后我运行以下命令行:

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]

例如

java -cp "D:\Automations\Selenium\Workspace\SimpleTest\bin";"D:\Automations\Selenium\Workspace\SimpleTest\JAR File\*" org.testng.TestNG runTest.xml

希望对您有帮助.

这篇关于无法读取类别上的方法-TestNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 05:23