8. Archive complete Xray comments¶
Continue from 7. Diagnose a failing case. Use the same xray-demo folder and activated environment.
Restore the passing, marked test before trying this archive recipe:
import pytest
@pytest.mark.xray("DEMO-1")
@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
Large parametrized suites can produce long comments. The default client policy limits each exported comment to 32,000 UTF-8 bytes. This is a configurable client choice, not a universal Jira/Xray server limit.
To see the behavior with our small example, deliberately choose a tiny limit:
python -m pytest -q test_example.py --xray-case-report=cases.json --jira-xray --xraypath=xray.json --allow-duplicate-ids --xray-parameter-details --xray-comment-limit=256 --xray-full-report=full-xray.json
Two new options work together:
--xray-comment-limit=256bounds each final exported comment to 256 UTF-8 bytes, including the truncation notice. It does not limit the entire request or attached evidence. The minimum is 256.--xray-full-report=full-xray.jsonsaves the complete original Xray payload before any comment is shortened.
Expected: 2 passed and a message containing truncated 1 comment(s).
| File | Result |
|---|---|
cases.json |
Both structured cases, unaffected by the comment limit. |
full-xray.json |
Full original comment containing both case identities and values. |
xray.json |
Shortened comment with an explicit TRUNCATED notice. |
If an oversized comment has no full-report path, export stops instead of silently losing text. If the archive cannot be written, export also stops. An otherwise passing pytest session then exits with code 3. Statuses and evidence are not truncated. Use the default limit for ordinary evaluation, then validate the appropriate size with your server administrator.
The full archive can contain values, failure text and evidence. Protect it like test data. All three report paths must differ. Files are replaced on each run; choose unique paths to retain history.