Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using pytest.mark.parametrize will miss some testcase in report #778

Open
1 of 3 tasks
Pegasus-Yang opened this issue Dec 5, 2023 · 2 comments
Open
1 of 3 tasks
Assignees
Labels
bug Something isn't working theme:core

Comments

@Pegasus-Yang
Copy link

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?

when i use pytest.mark.parametrize ,in specific data situations, i got same historyId for two diffent testcase, when report cameout, only one of two testcase show in report.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

Code to repeat :

data = [
    ["", "admin", 12345],
    ["admin", "", 12345],
]


@pytest.mark.parametrize("name, account, phone_number", data)
def test_add_member(name, account, phone_number):
    print(name, account, phone_number)

What is the expected behavior?

expected got 2 testcase in report

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Other information

Becourse in allure_pytest.util.get_history_id, only use values in original_values to generate historyId
Maybe use both name and value will solve the problem

@delatrie
Copy link
Contributor

delatrie commented Dec 5, 2023

Thank you for your report, @Pegasus-Yang !
There is a bug in how we hash arguments to create historyId. Due to this bug, empty strings don't affect the result, so the actual sequence of arguments that get into historyId is ["admin", 12345] in both cases. The same bug, I believe, causes some other collisions, like 1 and "1".
I'll fix it soon.

@delatrie delatrie self-assigned this Dec 5, 2023
@delatrie delatrie added bug Something isn't working theme:core labels Dec 5, 2023
@saaj
Copy link

saaj commented Jun 24, 2024

Here is a workaround when you don't need the history feature, but just one-off report:

find allure-results -name '*-result.json' -print \
  | xargs -r -n1 -P8 -i -- sh -c 'jq ".historyId=.uuid" {} | sponge {}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working theme:core
Projects
None yet
Development

No branches or pull requests

3 participants