2017-07-18 17 views
0

,而這樣做從Maven的安裝我收到此錯誤:執行默認測試:Maven的萬無一失,插件:2.17:測試失敗:有兩岔過程中出現錯誤

步驟 - Maven clean - 正常運行 Maven Install - 「[錯誤]無法執行目標org.apache.maven.plugins:maven-surefire-plugin:2.17:項目com.learn上的test(default-test) .selenium:目標執行缺省測試org.apache.maven.plugins:maven-surefire-plugin:2.17:測試失敗:分叉進程出錯「

我是新手到Selenium,任何幫助將非常感激,下面是我的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>com.learn</groupId> 
    <artifactId>com.learn.selenium</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>demo</name> 
    <description>demo</description> 
<properties> 
<suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile> 

</properties> 
<dependencies> 
    <dependency> 
    <groupId>org.testng</groupId> 
    <artifactId>testng</artifactId> 
    <version>6.11</version> 
    <scope>test</scope> 
</dependency> 
<dependency> 
    <groupId>org.seleniumhq.selenium</groupId> 
    <artifactId>selenium-java</artifactId> 
    <version>3.4.0</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.poi</groupId> 
    <artifactId>poi</artifactId> 
    <version>3.6</version> 
</dependency> 
<dependency> 
<groupId>org.apache.poi</groupId> 
<artifactId>poi-ooxml</artifactId> 
<version>3.6</version> 
</dependency> 
<dependency> 
<groupId>org.apache.poi</groupId> 
<artifactId>poi-ooxml-schemas</artifactId> 
<version>3.6</version> 
</dependency> 
<dependency> 
<groupId>dom4j</groupId> 
<artifactId>dom4j</artifactId> 
<version>1.1</version> 
</dependency> 
<dependency> 
<groupId>org.apache.xmlbeans</groupId> 
<artifactId>xmlbeans</artifactId> 
<version>2.3.0</version> 
</dependency> 
<dependency> 
      <groupId>com.relevantcodes</groupId> 
      <artifactId>extentreports</artifactId> 
      <version>2.40.1</version> 
     </dependency> 
<dependency> 
      <groupId>org.apache.maven.surefire</groupId> 
      <artifactId>surefire</artifactId> 
      <version>2.18.1</version> 
      <type>pom</type> 
     </dependency> 

    </dependencies> 
    <build> 

<plugins> 

<plugin> 

<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-compiler-plugin</artifactId> 
<version>3.0</version> 
<configuration> 
<compilerVersion>1.8</compilerVersion> 
<source>1.6</source> 
<target>1.6</target> 
</configuration> 
</plugin> 

<plugin> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-surefire-plugin</artifactId> 
<version>2.17</version> 
<configuration> 

<suiteXmlFiles> 
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile> 
</suiteXmlFiles> 

</configuration> 
</plugin> 
</plugins> 
</build> 
</project>** 

回答

2

我想,你需要maven-surefire-plugin版本升級到2.19.1,如果你正確地創建suiteXmlFile。並且需要指定suiteXmlFile的實際路徑,例如:<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>。如果你想使用<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>,你需要run mvn clean install test -DsuiteXmlFile=testngSuite.xml。 更多可以參考波紋管連接(Maven的萬無一失,插件文件):

http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html

http://www.seleniumeasy.com/maven-tutorials/how-to-execute-selenium-webdriver-testng-xml-using-maven

+0

嗨,我想通了一樣的,問題是我的TestNG的XML,一類是有哪些沒有出現在原來的項目中。 –

+0

好的...................... – Sharma

相關問題