allure-python
allure-python copied to clipboard
"Ids" of parametrized tests are not displayed in allure reports
I'm submitting a ...
- [*] bug report
- [ ] feature request
- [ ] support request => Please do not submit support request here, see note at the top of this template.
What is the current behavior?
Allure doesn't display "ids" in reports
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Write a parameterized test (@pytest.mark.parametrized) with multiple test data and "ids" params
screens:
What is the expected behavior?
Allure report display test cases in format: "test_case_name [ids value]"
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
- Allure version: 2.13.5
- Test framework: [email protected]
- Allure adaptor: [email protected]
Other information
I think this workaround with "dynamic" title in test body it will help you
@pytest.mark.parametrize('input, id_value', [(1, 'int'), ('1', 'str')], ids=['int', 'str'])
def test_1(input, id_value):
allure.dynamic.title(f'bla-bla [{id_value}]')
with allure.step('test'):
assert True
I think this workaround with "dynamic" title in test body it will help you
@pytest.mark.parametrize('input, id_value', [(1, 'int'), ('1', 'str')], ids=['int', 'str']) def test_1(input, id_value): allure.dynamic.title(f'bla-bla [{id_value}]') with allure.step('test'): assert True
thanks, but I understand correctly that the task I started is still a bug, or if I use allure.titles, then the only way to see ids next to them is to use a dynamic title?
My opinion is not a bug, allure.title
changes title as we specified.
@eg-b you can do this
@pytest.mark.parametrize('id', [1, 2])
@allure.title('title with {id}')
def test_test(id):
with allure.step('test step'):
pass
and report will look like
@rad96 thanks, but your option also suggests using test data in the title, instead of ids. The input parameter in the report is already visible on the right edge of the line. I was looking for an opportunity to use exactly ids
@eg-b made PR for that change, need @sseliverstov to review and check if these changes necessary
@eg-b made PR for that change, need @sseliverstov to review and check if these changes necessary
was this pr cancelled after all?
is there any other way to allow keeping the title defined in @allure.title()
decorator, along with the parameter ids?
Duplicate of #341 You can use the following workaround without the need to add an id as a parameter:
import allure
import pytest
@pytest.mark.parametrize("v", ["Value 1", "Value 2"], ids=["key-1", "key-2"])
def test_function(request, v):
allure.dynamic.title(f"Test {request.node.callspec.id} <-")