Skip to content

7. Diagnose a failing case

Continue from 6. Choose audit report contents. Use the same xray-demo folder and activated environment.

Temporarily replace the second expected value with 99:

import pytest

@pytest.mark.parametrize('value, expected', [(1, 2), (2, 99)], ids=['one-plus-one', 'two-plus-one'])
def test_add_one(value, expected):
    assert value + 1 == expected
python -m pytest -q --xray-case-config=case-config.json --xray-case-plan=failure.json

Expect exit code 1 and separate PASS/FAIL cases. Successful setup/teardown cannot turn a failure into PASS. Skips are ABORTED; expected failure is FAIL, non-strict unexpected pass is PASS, strict unexpected pass and fixture errors are FAIL. Any failed rerun attempt keeps FAIL. Incomplete collection or a crashed worker withholds all creation/import. Transport or mapping failures produce exit code 3. Restore the passing example before continuing.

import pytest

@pytest.mark.parametrize('value, expected', [(1, 2), (2, 3)], ids=['one-plus-one', 'two-plus-one'])
def test_add_one(value, expected):
    assert value + 1 == expected