Selenium webdriver 请解释使用TestNG的并行和分组执行,并解释TestNG.xml文件中的代码

Selenium webdriver 请解释使用TestNG的并行和分组执行,并解释TestNG.xml文件中的代码,selenium-webdriver,testng,Selenium Webdriver,Testng,请解释testng.xml,以便在Selenium webdriver中使用testng并行和分组运行测试脚本。解释testng.xml中为并行和分组执行提供的内容和参数。使用Paralle操作和使用testng分组执行有两种方法: 在pom.xml中 在testng.xml中 POM.xml 1。使用组 TestNG允许您对测试进行分组。然后可以执行一个或多个特定组。要使用Surefire执行此操作,请使用groups参数,例如: <plugins> [...] <plu

请解释testng.xml,以便在Selenium webdriver中使用testng并行和分组运行测试脚本。解释testng.xml中为并行和分组执行提供的内容和参数。

使用Paralle操作和使用testng分组执行有两种方法:

  • 在pom.xml中
  • 在testng.xml中
POM.xml

1。使用组

TestNG允许您对测试进行分组。然后可以执行一个或多个特定组。要使用Surefire执行此操作,请使用groups参数,例如:

<plugins>
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<groups>functest,perftest</groups>
</configuration>
</plugin>
[...]
</plugins>
</plugins>
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
[...]
</plugins>

[...]
org.apache.maven.plugins

TESTNG.XML

  • 这里有很多关于集团执行的细节和例子-

  • 下面是一些关于并行性的示例