GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@oatssss oatssss commented Mar 17, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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-python/allure-pytest/src/listener.py

Lines 246 to 256 in c217262

@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

  • Sign Allure CLA
  • Provide unit tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@oatssss

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

oatssss added 7 commits March 18, 2021 14:10
@oatssss
Add Behave support for Dynamic.link
356ee65
@oatssss
Add test case for behave dynamic links
480970c
@oatssss
Double line is required
4c053cc
@oatssss
Meet line length requirements
f7e92c7
@oatssss
Fix PEP8 E128
e2d7d22
@oatssss
Implement dynamic descriptions in behave listener
a408c62
@oatssss
Add behave test case for dynamic description
2982a3e
@oatssss
oatssss force-pushed the master branch from c187d6a to 2982a3e Compare March 18, 2021 18:11
@oatssss oatssss changed the title Support Dynamic.link for allure-behave Support Dynamic.link and Dynamic.description for allure-behave Mar 18, 2021
@sseliverstov
Merge branch 'master' into master
5b7b66b
sseliverstov
sseliverstov approved these changes Mar 22, 2021
View reviewed changes
@sseliverstov
sseliverstov merged commit 61da8af into allure-framework:master Mar 22, 2021
beckerGil pushed a commit to beckerGil/allure-python that referenced this pull request Apr 10, 2023
@oatssss @GilBecker-Anaplan
support Dynamic.link and Dynamic.description for allure-behave (via a…
817e341
…llure-framework#574)
IvanBuruyane pushed a commit to IvanBuruyane/allure-python that referenced this pull request Mar 19, 2024
@oatssss
support Dynamic.link and Dynamic.description for allure-behave (via a…
eacefcc
…llure-framework#574)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@sseliverstov sseliverstov sseliverstov approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

2 participants

@oatssss @sseliverstov
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.