2015-11-25 102 views
0

我使用allure framevork + testNG進行報告測試。我想從maven平行運行只有一個測試類如何在單線程中從Maven Surefire插件只運行一個TestNG類?

  <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>${maven-surefire-plugin.version}</version> 
      <configuration> 
       <testFailureIgnore>true</testFailureIgnore> 
       <argLine> 
        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" 
       </argLine> 

       <parallel>methods</parallel> 
       <threadCount>10</threadCount> 

       <!--suiteXmlFiles> 
        <suiteXmlFile>src/test/resources/testing.xml</suiteXmlFile> 
       </suiteXmlFiles--> 
      </configuration> 
      <dependencies> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjweaver</artifactId> 
        <version>${aspectj.version}</version> 
       </dependency> 
      </dependencies> 
     </plugin> 
  1. 如果我使用<suiteXmlFiles>,那麼AspectJ的就看不到我的測試中,比我需要寫在XML中的所有測試類(我不wan't做,因爲我使用aspectI)
  2. 如果我在maven-surefire-plagin中設置<parallel> - 比所有類中的所有方法都平行。

也許我可以包括一個類並行?

回答

1

您可以使用mvn test -Dtest=classname和上面的當前pom聲明。

這將在上面的類中並行觸發testmethods。

相關問題