File tree 1 file changed +22
-1
lines changed
allure-pytest/test/acceptance/label/bdd
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 1
1
""" ./examples/label/bdd/bdd_label.rst """
2
+ import json
2
3
3
- from hamcrest import assert_that
4
+ from hamcrest import assert_that , contains
4
5
from allure_commons_test .report import has_test_case
5
6
from allure_commons_test .label import has_epic
6
7
from allure_commons_test .label import has_feature
@@ -29,3 +30,23 @@ def test_multiple_bdd_label(executed_docstring_path):
29
30
has_story ("Alternative story" )
30
31
)
31
32
)
33
+
34
+
35
+ def test_set_bdd_label_as_object (executed_docstring_source ):
36
+ """
37
+ >>> import allure
38
+
39
+ >>> class SomeLabelStorage:
40
+ ... name = 'SomeLabel'
41
+
42
+ >>> @allure.feature(SomeLabelStorage)
43
+ ... def test_set_label_as_object_example():
44
+ ... pass
45
+ """
46
+ labels_data = [
47
+ label for label in executed_docstring_source .allure_report .test_cases [0 ]['labels' ] if label ['name' ] == 'feature'
48
+ ]
49
+ json_data = json .dumps (labels_data )
50
+
51
+ assert_that (labels_data , contains ('SomeLabelStorage' ))
52
+ assert_that (json_data , contains ('SomeLabelStorage' ))
You can’t perform that action at this time.
0 commit comments