allure-python icon indicating copy to clipboard operation
allure-python copied to clipboard

Failed steps are marked as passed

Open Thorzorr opened this issue 3 years ago • 4 comments

I'm submitting a ...

  • [x] 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?

Hello everyone I use python behave, I made it so that at this point the step is failed and a screen is made in the result, but that's why it is marked as passed and the next step after it is broken?

What is the expected behavior?

Failed steps are marked as failed

Please tell us about your environment:

  • Allure version: 2.13.8
  • Test framework: python behave
  • Allure adaptor: pytest-allure-adaptor 1.7.10

Other information

Step There_is_mistake

Screenshot at Apr 08 22-18-28

Thorzorr avatar Apr 08 '21 19:04 Thorzorr

@Thorzorr it's correct behavior.

all actions that solve the result of the step should be in environment.py-> after_step ()

if step.status == Status.failed
    context.app.base_page.get_screensot ()

Ljancek avatar Apr 09 '21 04:04 Ljancek

Thank you very much!!!!

пт, 9 апр. 2021 г. в 07:57, Ljancek @.***>:

@Thorzorr https://github.com/Thorzorr it's correct behavior.

all actions that solve the result of the step should be in environment.py-> after_step ()

if step.status == Status.failed context.app.base_page.get_screensot ()

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/allure-framework/allure-python/issues/582#issuecomment-816403563, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATS67DKM2IY3I4RMVFDDOO3TH2CMJANCNFSM42TQVQBQ .

Thorzorr avatar Apr 09 '21 05:04 Thorzorr

Thank you very much!!!! пт, 9 апр. 2021 г. в 07:57, Ljancek @.***>: @Thorzorr https://github.com/Thorzorr it's correct behavior. all actions that solve the result of the step should be in environment.py-> after_step () if step.status == Status.failed context.app.base_page.get_screensot () — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#582 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATS67DKM2IY3I4RMVFDDOO3TH2CMJANCNFSM42TQVQBQ .

Is this solved? or can you share the code that solved the issue?

aswinselva03 avatar Apr 27 '21 07:04 aswinselva03

Could someone please confirm if they are going to fix this issue. I am facing the same issue while using allure with allure-pytest 2.9.43

atique24 avatar Aug 13 '21 17:08 atique24

Not a bug. If an exception is not reraised in the except block, then the step is passed. Either rethrow the exception:

@when("...")
def when_do_something(context):
    try:
        do_something()
    except:
        get_screenshot()
        raise # <- note: the exception is reraised here

Or, as was suggested, move exception handling to after_step (see comment above).

delatrie avatar Dec 28 '22 04:12 delatrie