-1

我在一个 Maven 项目中使用 testng 对 selenium 进行自动化测试。我想为 testng 定义一个 xml 文件以在 POM.xml 中运行,但它不起作用。请帮忙!

这是我的 POM.xml 文件

        <dependencies>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>6.3.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>2.33.0</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.apache.maven.plugins</groupId>

                    <version>2.12.4</version>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/resource/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>     
                </plugins>
            </build>


</project>
4

1 回答 1

0
This is how it should look like

<plugins>
    [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.16</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>Src/test/resources/testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
    [...]
</plugins>
于 2013-10-25T10:22:24.897 回答