You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a couple of tests that are currently failing, but these are expected failures. We would like to keep these tests in a test run. Ideally, tag them as xfail (or anything else, tag name actually really doesn't matter), which would sign that the test should pass if the assertion fails and vice versa; the test should fail once the tested functionality gets fixed.
I did a couple of experiments (see below) with modifying test state, etc., but was unsuccessful. Am I just missing something, eventually any idea how such behaviour could be achieved?
# environment.pydefafter_scenario(_, scenario):
_xfail_handler(scenario)
def_xfail_handler(scenario):
print(scenario.status)
if"xfail"inscenario.tags:
ifscenario.status=="failed":
forstepinscenario.steps:
ifstep.status==Status.failed:
step.set_status(Status.passed)
step.captured.reset()
scenario.set_status("passed")
scenario.captured.reset()
elifscenario.status=="passed":
# Mark the scenario as failed because it unexpectedly passedscenario.set_status("failed")
scenario.failure_exception=Exception("Scenario unexpectedly passed but was expected to fail.")
print(scenario.status)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We have a couple of tests that are currently failing, but these are expected failures. We would like to keep these tests in a test run. Ideally, tag them as
xfail
(or anything else, tag name actually really doesn't matter), which would sign that the test should pass if the assertion fails and vice versa; the test should fail once the tested functionality gets fixed.I did a couple of experiments (see below) with modifying test state, etc., but was unsuccessful. Am I just missing something, eventually any idea how such behaviour could be achieved?
Beta Was this translation helpful? Give feedback.
All reactions