GeezerVison is showing github.com — Support Dynamic.link and Dynamic.description for allure-behave by oatssss · Pull Request #574 · allure-framework/allure-python
Conversation
oatssss
commented
Mar 17, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
There are no changes to allure-robotframework I suspect the check-errors are not related to my changes.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
oatssss
changed the title
Support Dynamic.link for allure-behave
Support Dynamic.link and Dynamic.description for allure-behave
Mar 18, 2021
Reviewers
1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.