【发布时间】:2016-01-16 14:02:31
【问题描述】:
我有一个像这样的 testNg 套件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="BlahServerSuite">
<test name="Creating Customer Test">
<classes>
<class name="com.node.service.scripts.server.CustomerTest" />
</classes>
</test>
</suite>
当我从 IDE 运行它时它运行正常。但是当我尝试使用“mvn test”从控制台执行它时,出现以下错误:
[TestNGClassFinder] Warning: Can't link and determine methods of class com.node.service.scripts.server.CustomerTest
我的 pom 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/testNode/java/com/testnode/service/scripts/server/serversuite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<groupId>groupId</groupId>
<artifactId>testNode</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
....
该项目由几个模块组成。即使 pom 文件位于 modul2(以及测试)中,我仍然需要在 pom 中设置套件文件的完整路径,否则 mvn 根本看不到测试套件。 这里可能是什么情况,我应该怎么看?
【问题讨论】:
标签: maven automated-tests testng