【发布时间】:2020-05-26 16:28:51
【问题描述】:
Feature: Addition tests
@one
Scenario: Add two numbers to pass
Given two numbers to add
When 2 and 3 are added together
Then the sum should be 5
@two
Scenario: Add two numbers to fail
Given two numbers to add
When 2 and 3 are added together
Then the sum should be 6
运行 >> 行为 --tags="@one" (或行为 --tags=one) 给我
@one
Scenario: Add two numbers to pass # features/Add.feature:4
Given two numbers to add # features/steps/Maths.py:4 0.000s
When 2 and 3 are added together # features/steps/Maths.py:8 0.000s
Then the sum should be 5 # features/steps/Maths.py:12 0.000s
@two
Scenario: Add two numbers to fail # features/Add.feature:10
Given two numbers to add # None
When 2 and 3 are added together # None
Then the sum should be 6 # None
正如预期的那样。
An yet Running >> 行为 --tags="@one or @two" 给我
@one
Scenario: Add two numbers to pass # features/Add.feature:4
Given two numbers to add # None
When 2 and 3 are added together # None
Then the sum should be 5 # None
@two
Scenario: Add two numbers to fail # features/Add.feature:10
Given two numbers to add # None
When 2 and 3 are added together # None
Then the sum should be 6 # None
这应该执行两个场景,并且根据每个教程,这似乎是运行多个场景的方式。我是否在这里遗漏了一些明显的东西(而且我肯定在运行“或”而不是行为 --tags="@one and @two")?
【问题讨论】:
标签: python bdd python-behave