Has anyone figured out a way to run the same cucumber scenario on multiple browsers/web drivers?

后端 未结 4 1043
死守一世寂寞
死守一世寂寞 2021-02-04 13:01

I\'m using cucumber + capybara for some web automation testing. I\'d love to be able to wire up my own tag (something like @all_browsers before the scenario) and have it run aga

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-04 13:19

    Here is my hack: (my situation is proving a feature works with javascript on and javascript off)

    1. Put each scenario into its own feature file.
    2. Move every line but the last into the 'Background:' section.
    3. Put the last line into a scenario per browser
    4. Tag each scenario appropriately

      Feature: a feature
      
      Background:
      Given a user "Jim" exists
      Given a user "Mike" exists
      
      When I login as "mike"
      And I follow "Lesson 1"
      
      And I follow "Upload a video"
      Then "#upload_a_video" should be active
      
      And I fill in "video_title" with "my film"
      And I attach the file "video.mov" to "video_upload"
      And I press "Post"
      
      Scenario: normal
      And I should see "my film"
      
      @javascript
      
      Scenario: javascript
      And I should see "my film"
      

提交回复
热议问题