问题描述
在执行 pom.xml 作为 maven 测试时没有测试要运行,但在执行 testng.xml 时它工作正常。
pom.xml - 尝试包括测试用例名称以及删除它们。没有任何效果
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>webAutomation</groupId>
<artifactId>webAutomation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version> 2.14.1</version>
<configuration>
<suiteXMLFiles>
<suiteXMLFile>testng.xml</suiteXMLFile>
</suiteXMLFiles>
<configuration>
<includes>
<include>ocs_TestCase.TC_001.java</include>
<include>ocs_TestCase.TC01_OCS_Search.java</include>
</includes>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
使用的Testng.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYstem "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<classes>
<class name="ocs_TestCase.TC001"/>
<class name="ocs_TestCase.TC01_OCS_Search"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
控制台登录执行 pom.xml 作为 maven 测试
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ webAutomation ---
[INFO] No tests to run.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.851 s
[INFO] Finished at: 2021-02-10T17:17:39+05:30
[INFO] Final Memory: 12M/220M
[INFO] ------------------------------------------------------------------------
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)