问题
How can i get to show all the logs of pytest into Allure. and what are stdout and stderr used for ?
Please check the Highlighted Code which i am referring to
回答1:
The stdout and stderr are used to display output produced by tests to those steams. To get them (and log) populated in Allure report your test or application executed by test have to produce output to corresponding streams.
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
Output from test above:
来源:https://stackoverflow.com/questions/53591282/how-to-append-logs-of-pytest-into-allure-report