allure-framework / allure-framework/allure-python

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

Đang mở
#584 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug theme:behave
Ngôn ngữ chính
Python
Star
814
Fork
260
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

#### 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]$
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tái hiện lỗi với features/test/first.feature, features/steps/fir.py và environment.py bằng lệnh Behave đã được báo cáo. Đọc allure_behave/hooks.py và listener.py tại đường dẫn after_step, sau đó xác minh rằng một scenario sử dụng context.execute_steps hoàn tất mà không có HOOK-ERROR và được báo cáo thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
testing
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.