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

Prashant Patil :

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?

Peter Thomas :

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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=419749&siteId=1