Skip to content

Commit e2ff718

Browse files
committed
Report all statuses to qaseio
Previously there was a logic like > If test passed multiple times - store only first passed status > But if test failed/skipped - store all such results It was designed to be used with parametrized fixtures, when multiple pytest items are related to single case from Qaseio. But this approach doesn’t work with https://github.com/pytest-dev/pytest-rerunfailures When test passed after re-run, by previous logic it was still marked as failed. Updated logic forces developers to use single test for single case and avoid parametrization for single case.
1 parent 0329c44 commit e2ff718

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,29 @@ def test_demo():
6464
"""Check qaseio plugin works as expected."""
6565
```
6666

67+
Each test should be associated with a single Qase case. Avoid parametrizing a
68+
test/fixture when its parameters represent multiple runs of the same case.
69+
In the meantime, it's OK to use parametrization for testing multiple cases
70+
using single pytest item, example:
71+
72+
```python
73+
@pytest.mark.parametrize(
74+
argnames="feature_enabled",
75+
argvalues=[
76+
pytest.param(
77+
False,
78+
marks=pytest.mark.qase("https://app.qase.io/case/DEMO-1"),
79+
),
80+
pytest.param(
81+
True,
82+
marks=pytest.mark.qase("https://app.qase.io/case/DEMO-1"),
83+
),
84+
],
85+
)
86+
def test_feature_displaying(feature_enabled: bool):
87+
pass
88+
```
89+
6790
Since this package is mostly used for selenium tests, it expects to get browser
6891
name to use in Qase.io test run name and in attachments path. By default you can
6992
provide it using `--webdriver` flag. But you can also override

pytest_qaseio/plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,11 @@ def pytest_runtest_makereport(self, item: pytest.Function): # noqa: ANN201
248248
)
249249
if not should_report:
250250
return
251-
case_id = self._tests[item.nodeid]
252251

253-
# No need to report same passed status,
254-
# while skipped and failed should be always reported
255-
if not case_id or (case_id in self._qase_results and report.passed):
252+
case_id = self._tests[item.nodeid]
253+
if not case_id:
256254
return
255+
257256
if not self._current_run:
258257
raise plugin_exceptions.RunNotConfigured()
259258
try:

0 commit comments

Comments
 (0)