Closed RoCCoCo13 closed 1 year ago
pytest.mark.parametrize
generates multiple tests with the same Xray ids from @pytest.mark.xray
decorator. This is why you see the exception. You can try to run pytest with the option: --allow-duplicate-ids
. It allows to have many tests with same Xray ID, but the overall status for the Xray test is calculated from all tests with the same ID.
Some example:
@pytest.mark.xray('Jira-1')
def test_foo_1():
assert True
@pytest.mark.xray('Jira-1')
def test_foo_2():
assert False
This will generate report with one XRAY test which has status FAIL
because one test passed and one failed.
{
"testKey": "Jira-1",
"status": "FAIL",
"comment": "..."
}
This is similar to your case with parametrize
.
Hi there,
So If we consider the outcome of a parametrized test as results for more than one test case in jira/xray, we should always use --allow-duplicate-id
to make it work, right?
In my opinion, this is a quite common case, do you think that it would worth mentioning it in the readme?
Many thanks for your work @fundakol!
Cheers
Hi there,
I am trying to report the test results to a list of test cases in a parametrized test, but when I try to execute the tests it reports that there are duplicated IDs of the tests.
I have checked the list and I couldn't find any duplicated ID.
Test:
Versions
Logs:
Any idea about the problem?
Thanks!