0
這裏是Java硒的webdriver Maven項目我的POM文件:不能在Maven項目運行TestNG的西裝
<?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>
<groupId>MyProject</groupId>
<artifactId>TestAutomation</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/wwwRegression.xml</suiteXmlFile>
<suiteXmlFile>src/test/resources/betaRegression.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.50.1</version>
</dependency>
</dependencies>
</project>
我需要做什麼 - 運行某些測試套件從CMD窗口上。從項目目錄我試圖用命令的不同變化:
mvn test -Dsurefire.suiteXmlFile=wwwRegression
mvn test -Dsuite=wwwRegression
mvn surefire:test -DsuiteXmlFile=wwwRegression
但兩者的測試套件的正在執行的所有時間。 有沒有人有任何想法如何運行某個測試套件?
感謝您的快速回復。 我已經完成了你的建議。我測試失敗:分叉進程中出現錯誤。 @Sighil – Jurii
請給出XML文件的完整路徑並重試。我編輯了答案 – Sighil
這並沒有幫助。我試圖像你所建議的那樣用完整的路徑運行它。這是我得到的。 C:\ Users \ Yurii \ IdeaProjects \ my_project> mvn -U clean install -testngFiles = src/test/resources/wwwRegression.out.xml [錯誤]執行Maven時出錯。 [錯誤]指定的用戶工具鏈文件不存在:C:\ Users \ Yurii \ IdeaProjects \ my_project \ estngFiles = src \ test \ resources \ wwwRegression.out.xml – Jurii