簡體   English   中英

在surefire插件中的maven多個測試套裝

[英]maven multiple test suits in surefire plugin

我正在使用TestNg和Maven以及surefire插件來運行我的測試。 我有幾個不同的測試,我想在同一個pom中運行。 目前要做到這一點我有兩個不同的XML文件定義,我已經定義了兩個配置文件來運行不同的XML文件,但這會不斷拋出錯誤!

我不知道應該如何解決這個問題。 任何幫助將不勝感激!

 <profile>
    <id>run</id>
     <activation>
        <property>
            <name>start</name>
            <value>true</value>
        </property>
     </activation>
     <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                  <skip>true</skip>
                  <suiteXmlFiles>
                    <suiteXmlFile>${project.build.directory}/resources/testng.xml</suiteXmlFile>
                  </suiteXmlFiles>

                </configuration>
                 <executions>
                  <execution>
                    <id>test</id>
                    <phase>integration-test</phase>
                    <goals>
                      <goal>test</goal>
                    </goals>
                    <configuration>
                      <skip>false</skip>
                    </configuration>
                  </execution>
                </executions>
            </plugin>
        </plugins>
     </build>
</profile>

想象一下,配置文件2幾乎相同但是xml套件文件是不同的

我得到一個解析錯誤:它無法在suiteXmlFile中找到測試類。 但是,如果我只使用一個配置文件只有一個xml文件,那么它是可以接受的。 失敗的那個也有效。

嘗試將suiteXmlFiles移動到執行配置,並使用更適合集成測試的maven-failsafe-plugin

暫無
暫無

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

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