0

すべてのテストを実行できますが、pom.xml でグループを構成し、maven を使用してテスト グループを実行する方法がわかりません。

私はTestNGフレームワークを使用していますが、pom.xmlにtesting.xmlのようなものは何も追加されていません。

誰でもtestngを使用してpom.xmlでグループを作成するのを手伝ってもらえますか..以下は私の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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.automation.tests</groupId>
    <artifactId>autotest</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>autotest</name>
    <url>http://maven.apache.org</url>

    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <classifier>jdk15</classifier>
            <version>5.11</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>LATEST</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>selenium-maven-plugin</artifactId>
                <!--<executions> <execution> <phase>pre-integration-test</phase> <goals> 
                    <goal>start-server</goal> </goals> <configuration> <background>true</background> 
                    </configuration> </execution> <execution> <id>stop-selenium</id> <phase>post-integration-test</phase> 
                    <goals> <goal>stop-server</goal> </goals> </execution> </executions> -->
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Skip the normal tests, we'll run them in the integration-test phase -->
                    <skip>true</skip>
                </configuration>

                <executions>
                <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>


    </build>
</project>
4

2 に答える 2

0

If you have the groups defined in your cases, and you want to specify the group in your pom, then you can do the following in your pom. By default, the test phase uses surefire plugin, but you can define the following explicitly to have your groups

<plugins>
[...]
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.16</version>
    <configuration>
      <groups>functest,perftest</groups>
    </configuration>
  </plugin>
[...]

于 2013-10-25T10:26:56.553 に答える