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

When the check is placed in the parent step and the child step asserts, the check becomes invalid. #167

Open
Faerie1999 opened this issue Jul 15, 2024 · 3 comments

Comments

@Faerie1999
Copy link

@check.check_func
def validate_something(a, b, c, d):
    with allure.step(f'some assertions'):
        with allure.step('aa'):
            assert a == 1
        with allure.step('b'):
            assert b == 2
        with allure.step('cccc'):
            assert c == 13
        with allure.step('dddd'):
            assert d == 4


def test_22():
    with check, allure.step("setup step"):
        assert 5 == 5
    validate_something(1,2,3,4)

or

def validate_something(a, b, c, d):
    with check, allure.step(f'some assertions'):
        with allure.step('aa'):
            assert a == 1
        with allure.step('b'):
            assert b == 2
        with allure.step('cccc'):
            assert c == 13
        with allure.step('dddd'):
            assert d == 4

run the code, the step dddd won't executed , just as below:
image

@lanbaoshen
Copy link

I think this is in line with the design expectations.
If your check point are not interdependent. , your code should be follow:

def validate_something(a, b, c, d):
    with allure.step(f'some assertions'):
        with check, allure.step('aa'):
            assert a == 1
        with check, allure.step('b'):
            assert b == 2
        with check, allure.step('cccc'):
            assert c == 13
        with check, allure.step('dddd'):
            assert d == 4

@Faerie1999
Copy link
Author

Faerie1999 commented Jul 31, 2024

I think this is in line with the design expectations. If your check point are not interdependent. , your code should be follow:

def validate_something(a, b, c, d):
    with allure.step(f'some assertions'):
        with check, allure.step('aa'):
            assert a == 1
        with check, allure.step('b'):
            assert b == 2
        with check, allure.step('cccc'):
            assert c == 13
        with check, allure.step('dddd'):
            assert d == 4

I have indeed done this before. if run, the step [some assertions] won't be marked as failed, but passed, and the four sub-steps will be executed, I hope if any sub step is failed, the parent should be marked as failed, and all sub-steps should be executed:

def validate_something(a, b, c, d):
    with allure.step(f'some assertions'):
        with check, allure.step('aa'):
            assert a == 1
        with check, allure.step('b'):
            assert b == 2
        with check, allure.step('cccc'):
            assert c == 13
        with check, allure.step('dddd'):
            assert d == 4


def test_22():
    with check, allure.step("setup step"):
        assert 5 == 5
    validate_something(1,2,3,4)

you can see more in allure-framework/allure-python#824

@okken
Copy link
Owner

okken commented Aug 27, 2024

I'd consider this a feature request, to support allure.step() in conjunction with check.

I would look at a PR for this, but since I don't use allure, I don't have plans to work on this.
I'd also want any changes to not affect performance negatively.

@okken okken changed the title bug: When the check is placed in the parent step and the child step asserts, the check becomes invalid. When the check is placed in the parent step and the child step asserts, the check becomes invalid. Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants