获取命令行黄瓜标签
Get command line cucumber tag
我有一个 运行 针对 3 个不同标签的功能。有些场景 运行 针对所有三个标签,有些场景针对两个标签,有些场景只针对一个标签。
@build_1 @build_2
Scenario: Test Case 1
Given I am on the home page
And I click the X button
Then I must see the text "function not available"
@build_1
Scenario: Test Case 2
Given I am on the home page
And I click the Y button
Then I must see the text "You pushed the Y button"
@build_2 @build_3
Scenario: Test Case 3
Given I am on the home page
And I click the Y button
Then I must see the text "function not available"
@build_3
Scenario: Test Case 4
Given I am on the home page
And I click the X button
Then I must see the text "Hey, this is neat!"
@build_1 @build_2 @build_3
Scenario: Test Case 5
Given I am on the home page
And I click the Z button
Then I must see the text "You pushed the Z button"
我运行场景使用了三个不同的命令:
cucucmber features/my_test.feature --tags @build_1
cucucmber features/my_test.feature --tags @build_2
cucucmber features/my_test.feature --tags @build_3
我已经大大简化了我的代码,考虑到在构建之间切换所花费的时间,我有必要以这种方式 运行 进行测试。
有什么方法可以判断当前 运行 是用哪个标签调用的?使用
scenario.source_tag_names
给出了给定场景的所有标签,我正在寻找在命令行上指定的标签。如果我运行
cucucmber features/my_test.feature --tags @build_2
对于场景 1,我得到
scenario.source_tag_names = ["@build_1", "@build2", "@build_3"]
我想要只给@build_2.
的东西
最后,我正在寻找一种方法来确保所有场景都针对各自的标签运行。
AfterConfiguration do |config|
puts config.tag_expressions
end
我有一个 运行 针对 3 个不同标签的功能。有些场景 运行 针对所有三个标签,有些场景针对两个标签,有些场景只针对一个标签。
@build_1 @build_2
Scenario: Test Case 1
Given I am on the home page
And I click the X button
Then I must see the text "function not available"
@build_1
Scenario: Test Case 2
Given I am on the home page
And I click the Y button
Then I must see the text "You pushed the Y button"
@build_2 @build_3
Scenario: Test Case 3
Given I am on the home page
And I click the Y button
Then I must see the text "function not available"
@build_3
Scenario: Test Case 4
Given I am on the home page
And I click the X button
Then I must see the text "Hey, this is neat!"
@build_1 @build_2 @build_3
Scenario: Test Case 5
Given I am on the home page
And I click the Z button
Then I must see the text "You pushed the Z button"
我运行场景使用了三个不同的命令:
cucucmber features/my_test.feature --tags @build_1
cucucmber features/my_test.feature --tags @build_2
cucucmber features/my_test.feature --tags @build_3
我已经大大简化了我的代码,考虑到在构建之间切换所花费的时间,我有必要以这种方式 运行 进行测试。
有什么方法可以判断当前 运行 是用哪个标签调用的?使用
scenario.source_tag_names
给出了给定场景的所有标签,我正在寻找在命令行上指定的标签。如果我运行
cucucmber features/my_test.feature --tags @build_2
对于场景 1,我得到
scenario.source_tag_names = ["@build_1", "@build2", "@build_3"]
我想要只给@build_2.
的东西最后,我正在寻找一种方法来确保所有场景都针对各自的标签运行。
AfterConfiguration do |config|
puts config.tag_expressions
end