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

前端 未结 1 1035
攒了一身酷
攒了一身酷 2020-12-20 06:32

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

相关标签:
1条回答
  • 2020-12-20 07:11

    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

    0 讨论(0)
提交回复
热议问题