Issue
I'm using Selenium with PYTEST to test a site. I would like to take a screenshot of the page whenever a test fails (and only when it fails).
Is there a way that I can do this? The docs are quiet when it comes to this (or I can't find it). I would assume that it would be something like
request.function.failed
and it would return a boolean or something.
This is what I wanted to do:
@pytest.fixture()
def something(request):
if request.function.failed:
print "I failed"
This would be added to a finalizer, of course. Can it be done? Using pytest 2.3.3
Thanks.
Solution
It can be done, not directly though. I just added an example to the docs. It probably makes sense to makes this easier by default, i.e. without requiring the use of a conftest.py hook. If you agree, please file an issue.
Answered By - hpk42
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.