How can we execute WebUI feature file against multiple browsers using parallel runner or distributed testing?

被刻印的时光 ゝ 提交于 2021-01-15 10:23:13

问题


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?


回答1:


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.

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  |

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' } |

EDIT: also see this answer: https://stackoverflow.com/a/62325328/143475

And for other ideas: https://stackoverflow.com/a/61685169/143475



来源:https://stackoverflow.com/questions/60387798/how-can-we-execute-webui-feature-file-against-multiple-browsers-using-parallel-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!