reportportal / agent-python-pytest

Framework integration with PyTest
Apache License 2.0
95 stars 102 forks source link

Separate test stages when using steps #332

Closed EyalrAtBay closed 1 week ago

EyalrAtBay commented 2 years ago

Hi, I have been using the nested steps in test reporting and it works really well, I wanted to ask if there are any plans to incorporate different test stages, i.e "set up", "test body" etc..

Technically it would mean any fixtures/methods marked as a @step and run before the collected test would appear collectively under a step named "Set up" in the UI, all steps related to the actual test/s would appear under "Test body" and any steps run after the actual test/s would appear under the "Teardown" step.

Allure has a similar functionality to further explain what I mean:

image

Appreciate your help and support.

rplevka commented 1 year ago

I came here to look for pretty much the same feature. I believe this could be achievable by using native, pytest fixture hooks.

It would be nice if the fixture logs were logged to the appropriate level (based on their scope) and a test item with a corresponding type (beforeTest , beforeMethod,...) was created for them.

HardNorth commented 1 week ago

@rplevka Not to appropriate level, since pytest call these hook after it started a test only. So if there is no test, no such hooks would be called. And if there is several tests, then session fixture will be called for the first one in the test collection and for the last one.

HardNorth commented 1 week ago

Please use: https://github.com/reportportal/agent-python-pytest/releases/tag/5.4.3 And enable fixture reporting with rp_report_fixtures = True in pytest.ini file.