0
爲什麼使用TestNG時'mvn test'爲我工作,但不是'mvn surefire:test'?它很有趣,因爲套件xml文件的位置是通過surefire插件配置的,但只有在執行常規Maven「測試」目標時纔會運行。當我使用'mvn surefire:test'時,那麼當文件物理上似乎存在於預期的位置時,就好像資源(或src/test/resources/testng.xml)文件對測試執行程序不可見:/ target /test-classes/testng.xml。爲什麼'mvn test'在使用TestNG時爲我工作,而不是'mvn surefire:test'?
這是我的配置。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<includes>
<include>Tests/**/*.java</include>
</includes>
<suiteXmlFiles>
<suiteXmlFile>
${project.build.testOutputDirectory}/${testng.suitexmlfile}
</suiteXmlFile>
</suiteXmlFiles>
<configuration>
<systemPropertyVariables>
<build-name>${testng.buildname}</build-name>
<testenv>${testng.testenv}</testenv>
</systemPropertyVariables>
<groups>${testng.groups}</groups>
</configuration>
</configuration>
</plugin>