本文主要是介绍jenkins+maven+testng时,报:[TestNGClassFinder] Warning: Can't link and determine methods of class,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错原因
由于maven执行测试类时无法判断要执行哪些case
解决办法
- 创建xml文件,示例:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="flight"><test name="example" preserve-order="true"><classes><class name="com.elong.android.flight.test.AirTest"><methods><include name="test"></include></methods><!-- <groups><run><include name="group1"></include></run></groups> --></class></classes></test></suite>
2 在maven-compiler-plugin和maven-surefire-plugin插件引入testng运行策略xml文件,如下示例
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.3</version><configuration><source>1.7</source><target>1.7</target><compilerArguments> <extdirs>libs/</extdirs> </compilerArguments> <suiteXmlFiles><suiteXmlFile>testflight.xml</suiteXmlFile> </suiteXmlFiles></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.19.1</version><configuration><suiteXmlFiles><suiteXmlFile>testflight.xml</suiteXmlFile> </suiteXmlFiles></configuration></plugin></plugins></build>
这篇关于jenkins+maven+testng时,报:[TestNGClassFinder] Warning: Can't link and determine methods of class的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!