我目前正在尝试自动化浏览器测试,并且在尝试将多个浏览器实现到一个功能文件中时遇到了问题
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
来了解这一点。您还可以查看配置文件。在一次测试运行中更改浏览器非常困难(并且不推荐)。切换浏览器需要相当多的时间,因此您真的不想在一次运行中执行此操作。