R
R
Relrin2014-07-07 22:00:04
Python
Relrin, 2014-07-07 22:00:04

What does xpassed mean when testing?

relrin @relrin :~/code/Helenae/tests$ python runtests.py
============================ test session starts == ===========================
platform linux2 -- Python 2.7.3 -- py-1.4.20 -- pytest-2.5.2
plugins: cov, twisted
collected 19 items
test_gui.py .......XXXXXX......
==================== 13 passed, 6 xpassed in 2.16 seconds =====================

That is, if I created, for example, such a test in pytest:
@pytest.mark.parametrize("login, password, fullname, email", [
    ("testuser", "123456", "Im test user", "[email protected]"),
    (" test user", "123456", "Im test user", "[email protected]"),
    (" test user ", "123456", "Im test user", "[email protected]"),
    ("test user", "123456", "Im test user", "[email protected]"),
    ("   test   user  ", "123456", "Im test user", "[email protected]"),
    (" te st u ser", "123456", "Im test user", "[email protected]"),
    pytest.mark.xfail(("", "123456", "Im test user", "[email protected]")),
    pytest.mark.xfail((" ", "123456", "Im test user", "[email protected]")),
    pytest.mark.xfail(("  ", "123456", "Im test user", "[email protected]")),
    pytest.mark.xfail((" t e ", "123456", "Im test user", "[email protected]")),
    pytest.mark.xfail((" t   e", "123456", "Im test user", "[email protected]")),
    pytest.mark.xfail((" t  e", "123456", "Im test user", "[email protected]")),
])
def test_registration_1(wxMainApp, login, password, fullname, email):
    Faker.clickHyperlink(wxMainApp, ID_NEW_MEMBER_TXT)
    Faker.clickDialogButtonOK(wxMainApp)
    wx.CallAfter(Faker.clickDialogButtonOK(wxMainApp.RegisterWindow))
    Faker.enterFakeRegisterData(wxMainApp.RegisterWindow, login, password, fullname, email)

Are the ones labeled xfail denoted by X and imply that the test passed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freshik, 2017-02-11
@freshik

Xpassed means that the test succeeded, although it was expected to fail.
From documentation :

You can use the xfail marker to indicate that you expect a test to fail:
@pytest.mark.xfail
def test_function():
    ...

This test will be run but no traceback will be reported when it fails. Instead terminal reporting will list it in the “expected to fail” (XFAIL) or “unexpectedly passing” (XPASS) sections.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question