简体   繁体   English

如何在Python-Behave中将摘要汇总到输出中

[英]How to get summary into an output in Python-Behave

This is a summary of the tests after it runs: 这是运行后的测试摘要:

1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
3 steps passed, 0 failed, 0 skipped, 0 undefined

I want to be able to print it into a file or have access to it from the modules. 我希望能够将其打印到文件中,或者可以从模块中访问它。 The behave documentations doesn't have an argument that makes the summary print into aa different output. 行为文档没有使摘要打印成不同输出的参数。

在脚本或触发测试的地方,为什么不简单地做一个

behave -o out_file > file_to_save_summary

Create an empty "output" folder in your behave folder. 在行为文件夹中创建一个空的“输出”文件夹。 Also create a file "behave.ini" and put it in your behave folder: 还要创建一个文件“ behave.ini”并将其放在行为文件夹中:

Here is the content of your "behave.ini" file: 这是您的“ behave.ini”文件的内容:

    [behave]
    junit: true
    junit_directory: <route_to_behave_folder>/output/
    stderr_capture=False
    stdout_capture=True

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM