【问题标题】:Selenium(JAVA) Grid launching only 10 browsers parallel in WindowsSelenium(JAVA) Grid 仅在 Windows 中启动 10 个并行浏览器
【发布时间】:2019-03-23 23:43:09
【问题描述】:

我正在使用 TestNg + Selenium (JAVA) Grid 来执行并行执行。

我的机器\服务器配置是

  • 处理器:Intel Xeon,CPU E5-2603 v4,2.20 GHz(8 个处理器)
  • 内存:64 GB
  • 系统类型:64 位
  • 操作系统:Window Server 2012 R2 标准版

我在同一台机器上有 HUB 和 3 个节点

  • HUb 命令 : java -jar selenium-server-standalone-3.1.0.jar -role hub
  • 节点命令 : java -Dwebdriver.chrome.driver=./chromedriver.exe -jar selenium-server-standalone-3.1.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=chrome, maxInstances=20 -port 6661
    (3 个不同节点的端口号是 6661,6662 和 6663。)

我有 100 多个带有 @Test TAG 的测试用例,但一次只有 10 个测试用例并行执行。我想同时执行 50 多个测试。我错过了什么?
提前致谢。

【问题讨论】:

  • 您是否在 标签上使用了并行属性? link
  • 您能展示一下您的 testng xml 的样子吗?有一种方法可以像这样设置线程数

标签: java windows selenium selenium-webdriver selenium-grid


【解决方案1】:

您使用 xml 中的以下配置设置并行线程的数量。比如:

如果你想并行运行你的测试方法(在这个例子中 MyTest 类包含多个 @Test 方法)

<suite name="mySuite" parallel="methods" thread-count="50">
  <test name="myTests">
    <classes>
      <class name="test.sample.MyTest1" />
    </classes>
  </test>     
</suite>

<suite name="mySuite" parallel="methods" thread-count="50">
  <test name="myTests">
    <packages>
      <package name="test.sample" />
   </packages>
 </test>
</suite>

如果您想为 50 个测试类运行 50 个线程(对于本示例,1 class= 1 个测试)。

<suite name="mySuite" parallel="tests" thread-count="50">
  <test name="thread 1">
    <classes>
      <class name="test.sample.MyTest1" />
   </classes>
  </test>
  <test name="thread 2">
    <classes>
      <class name="test.sample.MyTest2" />
   </classes>
  </test>
   ...
  <test name="thread 50">
    <classes>
      <class name="test.sample.MyTest50" />
   </classes>
  </test>
</suite>

对于其他选项,您可以查看 TestNG 文档:https://testng.org/doc/documentation-main.html#parallel-tests

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多