pytest-expected failure

Expected failure

method:

xfail(condition=None,reason=None,raises=None,run=True,strict=False)

Common parameters:

condition: the condition of the expected failure, must be passed reason: the reason for the failure, must be passed

Instructions:

[email protected](condition,reason=“xx”) This shows xfail, indicating that the error does not meet expectations
2. Display xpass -------> indicating that the error meets expectations

Generally not so, use pytest.raises to throw an interface exception first, and then assert whether the exception information meets expectations

Guess you like

Origin blog.csdn.net/qq_36875803/article/details/109232152