首页 > 解决方案 > 我们如何使用并行运行器或分布式测试针对多个浏览器执行 WebUI 功能文件?

问题描述

我能够使用并行运行器和在 karate-config.js 中定义的驱动程序针对单个浏览器(Zalenium)执行 WebUI 功能文件。我们如何使用并行运行程序或分布式测试针对多个浏览器(Zalenium)执行 WebUI 功能文件?

标签: javakarate

解决方案


使用 aScenario Outlineparallel runnerExamples空手道将并行运行表格的每一行。但是您必须将驱动程序配置移动到Feature.

只需在此示例项目中添加一个并行运行器并尝试:https ://github.com/intuit/karate/tree/master/examples/ui-test

Scenario Outline: <type>
  * def webUrlBase = karate.properties['web.url.base']
  * configure driver = { type: '#(type)', showDriverLog: true }

  * driver webUrlBase + '/page-01'
  * match text('#placeholder') == 'Before'
  * click('{}Click Me')
  * match text('#placeholder') == 'After'

Examples:
  | type         |
  | chrome       |
  | geckodriver  |

您可以尝试其他方法,这是另一种模式,当您有正常Scenario输入时main.feature-您可以稍后从Scenario Outline单独的“特殊”功能中调用该功能-仅在您想要进行这种并行时使用- UI测试的化。

Scenario Outline: <config>
  * configure driver = config
  * call read('main.feature')

Examples:
  | config!                  |
  | { type: 'chromedriver' } | 
  | { type: 'geckodriver' }  | 
  | { type: 'safaridriver' } |

编辑 - 也看到这个答案:https ://stackoverflow.com/a/62325328/143475

对于其他想法:https ://stackoverflow.com/a/61685169/143475

编辑 - 可以为所有测试重复使用相同的浏览器实例,并且空手道 CI 回归测试这样做,值得研究的想法:https ://stackoverflow.com/a/66762430/143475


推荐阅读