问题描述
我能够使用并行运行器和karate-config.js中定义的驱动程序针对单个浏览器(Zalenium)执行WebUI功能文件.如何使用并行运行程序或分布式测试在多个浏览器(Zalenium)上执行WebUI功能文件?
I am able to execute WebUI feature file against single browser (Zalenium) using parallel runner and defined driver in karate-config.js. How can we execute WebUI feature file against multiple browsers (Zalenium) using parallel runner or distributed testing?
推荐答案
使用Scenario Outline
和平行跑步者.空手道将并行运行Examples
表的每一行.但是您必须将驱动程序配置移至Feature
.
Use a Scenario Outline
and the parallel runner. Karate will run each row of an Examples
table in parallel. But you will have to move the driver config into the Feature
.
只需将并行运行器添加到此示例项目中,然后尝试: https ://github.com/intuit/karate/tree/master/examples/ui-test
Just add a parallel runner to this sample project and try: 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 |
还有其他可以尝试的方式,这是当您在main.feature
中具有普通Scenario
时的另一种模式-随后,您可以从单独的特殊"菜单中的Scenario Outline
中调用该模式.功能-仅在您想要进行此类UI测试并行化时使用.
There are other ways you can experiment with, here is another pattern when you have a normal Scenario
in main.feature
- which you can then call later from a Scenario Outline
from a separate "special" feature - which is used only when you want to do this kind of parallel-ization of UI tests.
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
这篇关于我们如何使用并行运行器或分布式测试针对多个浏览器执行WebUI功能文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!