Mah*_*are 9 pytest python-3.x allure
我如何才能将 pytest 的所有日志显示到 Allure 中。stdout 和 stderr 的用途是什么?
stdout和stderr用于显示对这些流的测试产生的输出。为了让它们(和log)填充到 Allure 报告中,您的测试或测试执行的应用程序必须向相应的流生成输出。
import logging
import sys
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
def test_001():
logger.info('Logged INFO message')
logger.warning('Logged WARNING message')
logger.error('Logged ERROR message')
print('Message outputted to stdout')
print('Message outputted to stderr', file=sys.stderr)
assert 1 == 1
Run Code Online (Sandbox Code Playgroud)
上述测试的输出:
归档时间: |
|
查看次数: |
9242 次 |
最近记录: |