Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added allure-robotframework adapter #214

Merged
merged 4 commits into from
Jun 10, 2018

Conversation

skhomuti
Copy link
Collaborator

@skhomuti skhomuti commented Apr 3, 2018

//: # (
. Thank you so much for sending us a pull request!
.
. Make sure you have a clear name for your pull request.
. The name should start with a capital letter and no dot is required in the end of the sentence.
. To link the request with isses use the following notation: (fixes #123, fixes #321)
.
. An example of good pull request names:
. - Add Russian translation (fixes #123)
. - Add an ability to disable default plugins
. - Support emoji in test descriptions
)

Context

Added allure-robotframework adapter.
Its a listener using allure-python-commons and allure-python-commons-test.

Checklist

@sseliverstov sseliverstov self-requested a review May 25, 2018 10:28
def __init__(self, logger_path=DEFAULT_OUTPUT_PATH):
self.reporter = AllureReporter()
self.logger = AllureFileLogger(logger_path)
self.stack = []
Copy link
Contributor

@ehborisov ehborisov May 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stack basically duplicates OrderedDict inside AllureReporter.
I think we can simply make the 'item_type' argument of AllureReporter.get_last_item optional, so it would return the last element inserted in the default case, this way you will get rid of this stack of uuids and use only AllureReporter methods. @sseliverstov what do you say?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ehborisov yes, i think I thought about it when I wrote this code, but I tried not to affect the code of commons. I think, now it can already be rewritten

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added use get_last_item where possible. I can't refuse use self.stack because step results does not have the uuid attribute now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, yeah, I apparently thought steps have uuids. Lets keep it.

uuid = uuid4()
self.reporter.get_item(self.stack[-1]).children.append(uuid)
self.stack.append(uuid)
test_case = TestResult(uuid=uuid,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a right place to generate a historyId from attributes['longname']

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

def test_passed_with_step(self):
assert_that(self.allure_report, has_test_case('Passed Case With Step',
with_status('passed'),
has_step('BuiltIn.No Operation',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 'BuiltIn.No Operation' is a robot framework constant, I would suggest to move it into some file with test constants for all tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done



def get_allure_tags(tags):
return [Label('tag', tag) for tag in tags]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use LabelType.TAG from allure_commons.types

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done



def get_allure_thread(pool_id):
return Label('thread', 'Thread #{number}'.format(number=pool_id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use LabelType.THREAD from allure_commons.types

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

self.append_message_to_last_item_log(message, level)

# listener event ends
def start_new_group(self, name, attributes):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can probably use attributes['metadata'] to add links to the suite.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I wanted to, but the metadata on different projects is different. Is it possible to parameterize this? For example, we use Task_url to specify the task number.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skhomuti, @ehborisov is it ready for merge?

Copy link
Contributor

@ehborisov ehborisov Jun 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skhomuti maybe just add a link to the suite if if was specified at Metadata section as "Metadata Link some_url"

(it would look something like this, I believe:
link = attributes['metadata'].get('Link', None)
if link:
...
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sseliverstov almost

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, @skhomuti do you fix it in this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will fix it. Later I'll think about a more universal solution

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@skhomuti skhomuti reopened this Jun 1, 2018
@sseliverstov sseliverstov merged commit 10a0cbb into allure-framework:master Jun 10, 2018
@sseliverstov
Copy link
Contributor

tnx @skhomuti !

beckerGil pushed a commit to beckerGil/allure-python that referenced this pull request Apr 10, 2023
beckerGil pushed a commit to beckerGil/allure-python that referenced this pull request Apr 10, 2023
IvanBuruyane pushed a commit to IvanBuruyane/allure-python that referenced this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants