Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python行为标记';s或逻辑似乎不起作用_Python_Bdd_Python Behave - Fatal编程技术网

Python行为标记';s或逻辑似乎不起作用

Python行为标记';s或逻辑似乎不起作用,python,bdd,python-behave,Python,Bdd,Python Behave,运行>>行为--tags=“@one”(或行为--tags=one) 给我 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 number

运行>>行为--tags=“@one”(或行为--tags=one) 给我

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或@two” 给我


这应该执行两个场景,根据每个教程,这似乎是运行多个场景的方式。我是否遗漏了一些明显的东西(我肯定是在运行“或”而没有行为--tags=“@one and@two”)?

没有答案,我只是还不能评论

我也有类似的问题

behave--tags=“@one和@two”


运行“和”^^^^^似乎会跳过所有测试,即使我的测试中肯定有两个标记。

虽然此功能在文档中有记录,但在中不可用,在编写此答案时为1.2.6。您的问题不久前已在中记录

很可能您已经安装了1.2.6或更低版本,在这种情况下,您应该使用以下其中一种进行逻辑or:

@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
behave--tags help
也提供了一些有用的信息

如果要升级,请卸载当前的
behave
版本,并安装最新的可用标记版本(此时为v1.2.7.v1)


说明和其他安装选项。

0buz-非常感谢。绝对的救命恩人!我确实在使用1.2.6。我一直在写一些可笑的复杂标签和场景来回避这个问题。但是没有了。阅读behave--tags help(作为公认的答案)中的“和”use“behave-t1-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
behave --tags=one,two

#that's the same thing as
behave --tags @one,@two
sudo pip uninstall behave
pip install git+https://github.com/behave/behave@v1.2.7.v1