簡體   English   中英

如何在單線程中僅運行Maven Surefire插件中的一個TestNG類?

[英]How to run only one TestNG class from Maven Surefire Plugin in single thread?

我將使用誘惑性的framevork + testNG報告測試。 我只想從maven並行運行一個測試類

           <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> ,則<suiteXmlFiles>將看不到我的測試,並且比我需要在xml中編寫所有測試類(我不想這樣做,因為我使用的是Aspectj)
  2. 如果我在maven-surefire-plagin中設置<parallel> ,那么所有類中的所有方法都是並行的。

也許我可以包括一個平行的課程?

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

這將並行觸發上述類中的測試方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM