Cucumber 使用多个浏览器的场景

Cucumber 使用多个浏览器的场景,cucumber,Cucumber,我目前正在尝试自动化浏览器测试,在尝试将多个浏览器实现为一个功能文件时遇到了一个问题 Feature: feature X Background: Given User on X using "Chrome" Scenario: X process in Chrome when x is then x etc.. Given User X using "Firefox" @Firefox Scenario: X process in Fire

我目前正在尝试自动化浏览器测试,在尝试将多个浏览器实现为一个功能文件时遇到了一个问题

Feature: feature X

  Background:
    Given User on X using "Chrome"

  Scenario: X process in Chrome
    when x is 
    then x etc..


  Given User X using "Firefox"
  @Firefox
  Scenario: X process in Firefox
    steps...etc


  Given User on X using "IE"
  @IE
  Scenario: X process in IE
    steps..etc
这些测试都运行良好,不在同一个功能文件中,但我不知道如何将它们分开,它们都运行在给定的第一个功能文件(Chrome)上

谢谢

Feature: X

  @Chrome
  Scenario: X process in Chrome
    Given User on X using "Chrome"


  @Firefox
  Scenario: X process in Firefox
    Given User on X using "Firefox"


  @IE
  Scenario: X process in IE
    Given User on X using "IE"

在不同浏览器上运行功能的方法是为每个浏览器单独进行测试运行。您的功能应该谈论的是功能,而不是您正在运行的浏览器

因此,假设您的功能被称为“注册”,您将运行该功能

cucumber features/registration.feature -t @chrome
cucumber features/registration.feature -t @ie
cucumber features/registration.feature -t @firefox

您可以通过运行
cucumber--help
来了解这一点。您还可以查看配置文件。在一次测试运行中更改浏览器非常困难(不推荐)。切换浏览器需要相当长的时间,所以你真的不想在一次运行中完成这项工作。

为什么你让step用户在X上使用“IE”(类似于Chrome和Firefox)而不在各自的场景中?它们都在运行Chrome,因为Chrome给定的步骤在后台步骤中,该步骤将在功能文件中的所有场景中运行。嗨,Grasshopper,我现在已将其更改为在场景中具有给定的内容,并删除了后台,但是现在它只是在Firefox中进行测试,你有标签过滤器吗for@Firefox当您运行测试时?控制台对运行的场景数量有何评论?它正在运行18个测试(6 x 3),第二个和第三个测试似乎指向firefox和IE,标签标签={“@firefox,@Chrome,@IE”},但是它只是重新启动Chrome,我将它们放在3个单独的功能文件中,并尝试同时运行它们,但第一个运行的浏览器仍然是用于所有场景的浏览器