maven中使用testng需要关联

来源:互联网 发布:mac touch bar fn 编辑:程序博客网 时间:2024/06/03 13:23

问题描述:当maven项目中下载了testng包,在调用后,执行maven test,未执行testng.xml中指定的测试类。


解决:在pom.xml处理添加testng依赖之外,需对testng进行关联

<build><!-- 添加插件 关联testng.xml --><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.17</version><configuration><suiteXmlFiles><!-- testng.xml文件路径吗,项目下路径为"res/testng.xml" ,则定义为res/${xmlFileName} --><suiteXmlFile>testng.xml</suiteXmlFile></suiteXmlFiles></configuration></plugin></plugins></build>

详细使用Maven 配置 Selenium + testNG + reportNG 运行环境参见https://www.cnblogs.com/yyhh/p/5226955.html



原创粉丝点击