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

How to add additional content to Summary section? #109

Closed
shreyashah opened this issue Mar 13, 2017 · 2 comments · Fixed by #152
Closed

How to add additional content to Summary section? #109

shreyashah opened this issue Mar 13, 2017 · 2 comments · Fixed by #152

Comments

@shreyashah
Copy link

shreyashah commented Mar 13, 2017

I need to add a Score value to the summary section in html report. There is a mention about how to add additional content to Environment section but not for summary. Please guide me on this.

I am developing a feature to score the test module based on the weightage given to test cases and applying mathematics to obtain the final score for the entire module. I need to print this score either in summary section or before the results table.

@davehunt
Copy link
Collaborator

Interesting, though the summary section is not limited to a module, it represents the entire test session. It sounds like you'll need a new hook for extending the summary section. Please feel free to open a pull request introducing a pytest_html_results_summary hook. You could either try to add a structure, so this hook gets a list of key, value pairs for the label and value, or just pass around the containing element from the HTML. Note that there's associated JavaScript here for filtering so you'd want to ensure that doesn't break. Another option might be a simple pytest_html_results_prefix hook that by default is empty, and allows you to just put whatever HTML you'd like.

@suchitha92
Copy link

suchitha92 commented Jun 11, 2020

I would like to access the config data inside the pytest_html_results_summary hook to add the details of the command being invoked to run the test as a part of summary. Something like below to appear in the report after summary section"

Summary
2 tests ran in 3.31 seconds.

(Un)check the boxes to filter the results.

1 passed, 1 skipped, 0 failed, 0 errors, 0 expected failures, 0 unexpected passes

Command to reproduce the test
pytest -v --report=report.html --self-contained-html --preset 1"

Currently, there is only provision to add some generic string in the pytest_html_results_summary hook. So I'm not able to access the preset config option inside the hook.

Is there any other way to acheive this? Please let me know on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants