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

Fix historyId to be dependent on dynamic allure parameters #743

Closed
1 of 3 tasks
delatrie opened this issue Apr 19, 2023 · 1 comment · Fixed by #745
Closed
1 of 3 tasks

Fix historyId to be dependent on dynamic allure parameters #743

delatrie opened this issue Apr 19, 2023 · 1 comment · Fixed by #745
Assignees
Labels
bug Something isn't working contribute Call for a contribution theme:pytest

Comments

@delatrie
Copy link
Contributor

delatrie commented Apr 19, 2023

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?

Parameters added via the allure.dynamic.parameter inside a test body don't affect allure history of the test.

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

Run the following example multiple times to produce multiple *-result.json files:

import allure
import time

def test_issue743_reproduction():
    allure.dynamic.parameter("time", time.perf_counter())

These results all have the same historyId. In such a case allure reporter shows us only one test case with several retries:

image

What is the expected behavior?

There should exists one test case per run, each with no retries in a way, similar to native pytest parameters.

  1. Take the nodeid of a test.
  2. Take all dynamic parameters of the test with excluded set to False.
  3. Sort the parameters alphabetically by their names (historyId should not depend on parameters order).
  4. Append a string representation of the values to the nodeid (use some separator to prevent collisions with other tests).
  5. Calculate hash of the resulting string and use it as historyId.

Related code:

test_result.historyId = md5(item.nodeid)

Please tell us about your environment:

  • Allure version: 2.20.1
  • Test framework: pytest@7.3.1
  • Allure adaptor: allure-pytest@2.13.1
@delatrie delatrie added bug Something isn't working theme:pytest contribute Call for a contribution labels Apr 19, 2023
@delatrie delatrie self-assigned this Apr 22, 2023
@delatrie
Copy link
Contributor Author

This also blocks #430.

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

Successfully merging a pull request may close this issue.

1 participant