小编Ala*_*lan的帖子

如何仅显示行为中失败的测试?

我有一个 Python 3.4 项目,其中包含在behave框架(版本 1.2.5)中构建的测试。当我运行测试时,我得到数百行输出,其中大部分描述了没有问题的步骤。当场景失败时,我需要滚动所有这些输出来查找失败(这很容易注意到,因为它是红色的,而通过的步骤是绿色的,但我仍然需要查找它)。

有没有办法behave只显示失败场景的输出?理想情况下,我将获得所有失败场景的输出,以及通过/失败/跳过的功能/场景/步骤数量末尾的摘要。如果它打印出所有内容但将所有失败放在底部,我也会感到满意。

我已经behave --help浏览过这个网站,但没有找到任何相关内容。然而,我肯定不是第一个对此感到恼火的人,我想有一些方法可以做到这一点。谢谢您的帮助!

编辑:该--quiet标志简化了输出,但不会删除它。例如,这个输出:

Scenario Outline: Blank key identification -- @1.3 blank checks # tests/features/tkg.feature:15 Given we have pages with the wrong checksum # tests/features/steps/tkg_tests.py:30 0.000s When we check if the key is blank # tests/features/steps/tkg_tests.py:50 0.000s Then it is not blank # tests/features/steps/tkg_tests.py:55 0.000s

当使用该--quiet标志运行时变为:

Scenario Outline: Blank key identification -- @1.3 blank checks Given we have pages with the wrong checksum …

python acceptance-testing python-behave

5
推荐指数
1
解决办法
2653
查看次数

SML是否与Python的范围()类似?

我正在寻找一个带有非负整数的SML函数,并返回从0到最大但不包括给定值的所有整数的列表,类似于Python中的range().是的,我可以(并且已经)编写自己的内容,但我更喜欢内置的内容,我不需要复制并粘贴到我想要使用它的每个项目中.任何想法?提前致谢!

% Python code
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

(* SML code: my implementation; I'd prefer a built-in version *)
fun range x = 
    let fun helper current stop = 
        if current = stop 
        then nil 
        else current :: (helper (current + 1) stop)
    in helper 0 x
    end;

(* my code when run *)
- range 10;
val it = [0,1,2,3,4,5,6,7,8,9] : int list
Run Code Online (Sandbox Code Playgroud)

python range sml

2
推荐指数
1
解决办法
1862
查看次数

标签 统计

python ×2

acceptance-testing ×1

python-behave ×1

range ×1

sml ×1