allure-framework / allure-framework/allure-python

Getting `HOOK-ERROR in after_step` if `context.execute_steps` used in any step of Behave Scenario.

Aperta
#584 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug theme:behave
Lingua principale
Python
Stelle
814
Fork
260
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

#### I'm submitting a ...
bug report

#### What is the current behavior?
When ever I am using the plugin and executing behave tests I am getting error `HOOK-ERROR in after_step: KeyError:` everytime If any step of the Scenario is using method `context.execute_steps`.

#### If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Yes above behavior is a bug,
How to reproduce the issue:
I am putting my directory structure:
```
features/
├── environment.py
├── steps
│   └── fir.py
└── test
└── first.feature

2 directories, 3 files
```
Here content of `first.feature` file
```
Feature: Learn Behave

Scenario: Testing diffrent data transfer
Given Simple function "value of xyz"
```
Content of `fir.py`
```
from behave import Given, When, Then
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

@Given("Simple function {xyz}")
def simp(context, xyz):
context.execute_steps(u"""
given test func 2
""")
assert True

@Given("test func 2")
def text(context):
assert True
```
Content of `environment.py`
```
from allure_behave.hooks import allure_report
allure_report()
```
And when I try to run my feature file I am getting error `HOOK-ERROR in after_step: KeyError: 'some uuid'`

#### What is the expected behavior?
Behave tests should work fine.

#### Please tell us about your environment:

- Allure version: 2.8.40
- Test framework: behave 1.2.6
- Python: Python 3.8.7

#### Other information

Output and command I am running
```
(test) [vipikuma@kvy my_behave_project]$ behave features/test/first.feature -v --no-color
Using defaults:
color True
show_snippets True
show_skipped True
dry_run False
show_source True
show_timings True
stdout_capture True
stderr_capture True
log_capture True
logging_format %(levelname)s:%(name)s:%(message)s
logging_level 20
steps_catalog False
summary True
junit False
stage None
userdata {}
default_format pretty
default_tags
scenario_outline_annotation_schema {name} -- @{row.id} {examples.name}
Supplied path: "features/test/first.feature"
Primary path is to a file so using its directory
Trying base directory: /home/vipikuma/work_stuff/my_behave_project/features/test
Trying base directory: /home/vipikuma/work_stuff/my_behave_project/features
Using defaults:
color True
show_snippets True
show_skipped True
dry_run False
show_source True
show_timings True
stdout_capture True
stderr_capture True
log_capture True
logging_format %(levelname)s:%(name)s:%(message)s
logging_level 20
steps_catalog False
summary True
junit False
stage None
userdata {}
default_format pretty
default_tags
scenario_outline_annotation_schema {name} -- @{row.id} {examples.name}
Feature: Learn Behave # features/test/first.feature:1

Scenario: Testing diffrent data transfer # features/test/first.feature:3
Given Simple function "value of xyz" # features/steps/fir.py:6
Captured stdout:
HOOK-ERROR in after_step: KeyError: '7fac0091-918a-4de2-84e9-22defb2eb31a'
File "/home/vipikuma/work_stuff/my_behave_project/test/lib64/python3.8/site-packages/behave/runner.py", line 545, in run_hook
self.hooks[name](context, *args)
File "/home/vipikuma/work_stuff/my_behave_project/test/lib64/python3.8/site-packages/allure_behave/hooks.py", line 68, in after_step
self.listener.stop_behave_step(step)
File "/home/vipikuma/work_stuff/my_behave_project/test/lib64/python3.8/site-packages/allure_behave/listener.py", line 168, in stop_behave_step
self.logger.stop_step(self.current_step_uuid, stop=now(), status=status, statusDetails=status_details)
File "/home/vipikuma/work_stuff/my_behave_project/test/lib64/python3.8/site-packages/allure_commons/reporter.py", line 93, in stop_step
self._update_item(uuid, **kwargs)
File "/home/vipikuma/work_stuff/my_behave_project/test/lib64/python3.8/site-packages/allure_commons/reporter.py", line 17, in _update_item
item = self._items[uuid] if uuid else self._items[next(reversed(self._items))]

Failing scenarios:
features/test/first.feature:3 Testing diffrent data transfer

0 features passed, 1 failed, 0 skipped
0 scenarios passed, 1 failed, 0 skipped
0 steps passed, 1 failed, 0 skipped, 0 undefined
Took 0m0.000s
(test) [vipikuma@kvy my_behave_project]$
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il malfunzionamento con features/test/first.feature, features/steps/fir.py ed environment.py usando il comando Behave indicato. Leggi allure_behave/hooks.py e listener.py nel percorso after_step, quindi verifica che uno scenario che usa context.execute_steps venga completato senza un HOOK-ERROR e venga segnalato correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
testing
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.