如何使用 testng 在 maven 中按顺序 运行 整个测试用例?

How to run whole test cases sequentially in maven using testng?

  1. 我想 运行 在 java maven 中使用 testng 按顺序 运行 我的整个测试用例。

  2. 如何运行顺序测试套件?

使用 Maven Surefire Plugin with TestNG(使用套件 XML 文件)

<plugins>
    [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
    [...]
</plugins>

要了解如何配置 testng.xml 请关注 TestNG documentation

希望这些信息能为您提供正确的指导。