Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion allure-pytest-bdd/test/pytest_bdd_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@given(parsers.parse("feature file {name} with content:\n\"\"\"\n{feature}\n\"\"\""))
def feature_definition(feature, testdir, name="example"):
testdir.makefile(".feature".format(name=name), **dict([(name, feature)]))
testdir.makefile("{name}.feature".format(name=name), **dict([(name, feature)]))
pass


Expand Down
2 changes: 1 addition & 1 deletion allure-python-commons/src/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ def __hash__(self):
return hash(self.label.name)
return hash(repr(self))

return sorted([wl.label for wl in set([Wl(l) for l in reversed(labels)])])
return sorted([wl.label for wl in set([Wl(label) for label in reversed(labels)])])
11 changes: 11 additions & 0 deletions allure-robotframework/examples/label/labels_library.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

import allure


@allure.label('layer', 'UI')
def open_browser_with_ui_layer():
pass


def add_custom_label(label_type, *labels):
allure.dynamic.label(label_type, *labels)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

.. code:: robotframework

*** Settings ***
Library ./labels_library.py
*** Test Case ***
Test Case With Custom Labels
[Setup] Open Browser With UI Layer
Add Custom Label stand Alpha Beta
15 changes: 15 additions & 0 deletions allure-robotframework/src/listener/allure_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,21 @@ def _report_messages(self, messages):
self.lifecycle.attach_data(uuid=uuid4(), body=attachment, name='Keyword Log',
attachment_type=AttachmentType.HTML)

@allure_commons.hookimpl
def decorate_as_label(self, label_type, labels):
def deco(func):
def wrapper(*args, **kwargs):
self.add_label(label_type, labels)
func(*args, **kwargs)
return wrapper
return deco

@allure_commons.hookimpl
def add_label(self, label_type, labels):
with self.lifecycle.update_test_case() as case:
for label in labels if case else ():
case.labels.append(Label(label_type, label))

@allure_commons.hookimpl
def attach_data(self, body, name, attachment_type, extension):
self.lifecycle.attach_data(uuid4(), body, name=name, attachment_type=attachment_type, extension=extension)
Expand Down
2 changes: 1 addition & 1 deletion allure-robotframework/test/label/testcase_bdd_label.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Library ../test_allure_library.py

*** Test Case ***
Run Without options
${allure_report} Run Robot With Allure examples/label/
${allure_report} Run Robot With Allure examples/label
${test_case} Should Has Test Case ${allure_report} Test Cases With BDD Labels
Should Has Label ${test_case} epic Tag
Should Has Label ${test_case} feature Label
Expand Down
12 changes: 12 additions & 0 deletions allure-robotframework/test/label/testcase_custom_labels.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*** Settings ***
Library ../run_robot_library.py
Library ../test_allure_library.py


*** Test Case ***
Run Without options
${allure_report} Run Robot With Allure examples/label/testcase_custom_labels.rst
${test_case} Should Has Test Case ${allure_report} Test Case With Custom Labels
Should Has Label ${test_case} layer UI
Should Has Label ${test_case} stand Alpha
Should Has Label ${test_case} stand Beta