-
Notifications
You must be signed in to change notification settings - Fork 243
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
Display of parametrized tests can be improved #722
Comments
That comes from pytest itself (part of |
Also - if you're willing to take advantage of the hooks pytest-html has for customizing your report, this is well within the user's ability to clean up. https://pytest-html.readthedocs.io/en/latest/user_guide.html#modifying-the-results-table Here's an example of what can be done with a few standard tweaks and taking advantage of |
It is a shame that pytest runner views a parametrized test as a seperate testcase but I would imagine it has to do with the way the runtest flow is. @BeyondEvil In my case i want a parametrized test reproduced as a tree. Here is a example of what how I am trying to do it:
The test_equal_1::a and test_equal_1::b is parametrized testcase, TestsEqual, TestsNotEqual is a class and the rest is just testcases |
I'm not entirely sure what you're trying to do w.r.t. the actual HTML report. A mockup would help. |
I tried to recreate what i want in a image. My goals:
It could be done in a simple way like seperating it with a big fat black like, the only goal for me is to visually see a file, testcase and testsuite seprated and not combining testsuite, testcase and parametrized tests into a single "Test" field. So this would give the "tree" flow as shown above in my other comment. There are so many ways to do it:
The part where it has a table/area under the testcase is something i want to take more advantage of to include photos and such as way pytest-html work with linked photos or just including it in the table does not work in my case. |
I wonder if this would be a first step to accomplish what you want: #177 I think you can accomplish what you want, maybe not all of it but some of it, today. But it would require multiple hooks and a lot of code. Both python and HTML. |
You are right. Specially #33 is what i want except the parameterise I think maybe the first step might actually to split some of the functions in the basereport.py so you could override them. I am still working on figuring out how everything is working but from what I have concluded then it would be a good idea for basereportBase.Report.pytest_runtest_logreport to call subfunctions instead of handling the cells, links, data and so on in the function. Then you can override and modify them much easier. Right now If i had to customize my html i have to make a whole replacement of the pytest_runtest_logreport. Do you think it would be a good idea if i did that? |
I'm happy to review any PR that makes the code more extensible. Keep in mind that for some of the things that happen in I would also encourage you to take a TDD approach to the changes. 😊 |
When I execute this test function:
The pytest-html report displays this test name:
test/param_module_test.py::test_1[aaa-111-hello]
Wouldn't be better to display this?
test/param_module_test.py::test_1(aaa, 111, hello)
The text was updated successfully, but these errors were encountered: