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

Support allure.title decorator for fixtures #210

Closed
1 of 3 tasks
tikon93 opened this issue Mar 16, 2018 · 3 comments · Fixed by #527
Closed
1 of 3 tasks

Support allure.title decorator for fixtures #210

tikon93 opened this issue Mar 16, 2018 · 3 comments · Fixed by #527

Comments

@tikon93
Copy link

tikon93 commented Mar 16, 2018

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?

All of fixtures are shown at report as they named in code.

What is the expected behavior?

I suggest to support allure.title decorator for fixtures as it made for tests.
Code example:

    @allure.title('custom title')
    @pytest.fixture(autouse=True)
    def function_fixture(self,request,pytestconfig):

Please note that it should have effect both for setup and teardown steps. Also, there are old-style fixtures and yield fixtures - both of them should have an ability to use allure.title.

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

It will add possibility to make abstract of fixture representation in report from its realization in code. Reports will be easier to read for people not relating to code (managers etc).

Please tell us about your environment:

  • Allure version: 2.6.0
  • Test framework: pytest@3.4.2
  • Allure adaptor: allure-pytest@2.3.2b1
@symonk
Copy link

symonk commented Feb 27, 2019

I will look into this one, I have a need for it personally also

@ShurikMen
Copy link
Contributor

Maybe this is what is required?

import pytest
import allure


@pytest.fixture(name='Какая-то фикстура')
def some_fixture():
    with allure.step('Подшаг в фикстуре, при настройке'):
        pass
    yield "Эта фиктура возвращает волшебное слово"
    with allure.step('Подшаг в фикстуре, при завершении'):
        pass


class TestClassOne:
    @pytest.mark.usefixtures('Какая-то фикстура')
    def test_1(self, request):
        with allure.step('Шаг в функции'):
            allure.attach(request.getfixturevalue('Какая-то фикстура'), 'Получили из фикстуры:', allure.attachment_type.TEXT)

image

@rad96
Copy link
Contributor

rad96 commented Nov 30, 2020

Maybe this is what is required?

import pytest
import allure


@pytest.fixture(name='Какая-то фикстура')
def some_fixture():
    with allure.step('Подшаг в фикстуре, при настройке'):
        pass
    yield "Эта фиктура возвращает волшебное слово"
    with allure.step('Подшаг в фикстуре, при завершении'):
        pass


class TestClassOne:
    @pytest.mark.usefixtures('Какая-то фикстура')
    def test_1(self, request):
        with allure.step('Шаг в функции'):
            allure.attach(request.getfixturevalue('Какая-то фикстура'), 'Получили из фикстуры:', allure.attachment_type.TEXT)

image

That's looks like a complicated overhead
I made a little hack for parsing allure tag directly from source, it works, but it don't support any parametrization

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

Successfully merging a pull request may close this issue.

5 participants