FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support Dynamic.link and Dynamic.description for allure-behave by oatssss · Pull Request #574 · allure-framework/allure-python · GitHub

Support Dynamic.link and Dynamic.description for allure-behave - #574

Merged
sseliverstov merged 8 commits into
allure-framework:masterfrom
oatssss:master
Mar 22, 2021
Merged

Support Dynamic.link and Dynamic.description for allure-behave#574
sseliverstov merged 8 commits into
allure-framework:masterfrom
oatssss:master

Conversation

oatssss commented Mar 17, 2021
edited
Loading

Copy link
Copy Markdown
Contributor

Context

Hardcoded link tags in .features don't allow for dynamically adding links to the report. The dynamic use-case can be addressed with allure.dynamic.link(), however it appears to be a no-op for allure-behave. This PR adds the missing add_link hook to the behave listener.

With these changes, in addition to:

@allure.issue:https://jira.example.com/JIRA-1234
Scenario: Scenario with passed step
    Given simple passed step

we can also do:

import allure

def before_scenario(context, scenario):
    allure.dynamic.issue("https://jira.example.com/JIRA-1234", "JIRA-1234")

I used the pytest implementation as a reference for these changes:

@allure_commons.hookimpl
def add_link(self, url, link_type, name):
test_result = self.allure_logger.get_test(None)
if test_result:
pattern = dict(self.config.option.allure_link_pattern).get(link_type, u'{}')
link_url = pattern.format(url)
new_link = Link(link_type, link_url, link_url if name is None else name)
for link in test_result.links:
if link.url == new_link.url:
return
test_result.links.append(new_link)

Checklist

oatssss commented Mar 17, 2021

Copy link
Copy Markdown
Contributor Author

There are no changes to allure-robotframework I suspect the check-errors are not related to my changes.

oatssss changed the title Support Dynamic.link for allure-behave Support Dynamic.link and Dynamic.description for allure-behave Mar 18, 2021
sseliverstov merged commit 61da8af into allure-framework:master Mar 22, 2021
IvanBuruyane pushed a commit to IvanBuruyane/allure-python that referenced this pull request Mar 19, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL