Execute Code If A Test Fails With Py.test
I'm doing UI test automation on Android using Appium and py.test. I'd like to be able to save a bug report using adb after a test fails. Is there a way to tell if a test fails in
Solution 1:
You can implement a pytest_runtest_logreport hook in your conftest.py like this:
def pytest_runtest_logreport(report):
if report.when == 'call' and report.failed:
# save bug report
For more information, see Woking with plugins and conftest files.
Post a Comment for "Execute Code If A Test Fails With Py.test"