Skip to content

Draft only: Various properties to xunit output - #4165

Closed
rikerfi wants to merge 12 commits into
robotframework:masterfrom
rikerfi:Xunit-properties-tryout
Closed

rikerfi wants to merge 12 commits into
robotframework:masterfrom
rikerfi:Xunit-properties-tryout

Conversation

@rikerfi

@rikerfi rikerfi commented Dec 8, 2021 •

Copy link
Copy Markdown
Contributor

This is a draft PR for solving issue #3944 Request for log_property functionality for xunit writer.
Now also tests implemented.

Comment thread src/robot/reporting/xunitwriter.py Outdated

def __init__(self, xml_writer):
self._writer = xml_writer
self.root = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this needed for something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Not Anymore

Comment thread src/robot/reporting/xunitwriter.py Outdated
if suite.metadata or suite.doc:
self._writer.start('properties')
if suite.doc:
self._writer.element('property', attrs={'name': 'Suite Documentation', 'value': suite.doc})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just Documentation would probably be better than Suite Documentation. We use that in the data as well.

if suite.metadata:
for n, v in suite.metadata.items():
self._writer.element('property', attrs={'name': n, 'value': v})
self._writer.end('properties')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for if here, it would be fine to just loop over possible metadata items. Using name and value´ instead of nandw` would be a bit better as well. We've generally used one character variable names only in very tight scopes such as in list comprehensions.

Comment thread atest/robot/output/xunit.robot Outdated
... Test failed but its tags matched '--SkipOnFailure' and it was marked skipped.\n\nOriginal failure:\n${MESSAGES}
Element Attribute Should Be ${skips}[0] type SkipExecution
Run Keyword And Expect Error No element matching 'testsuite/properties' found.
... Get XUnit Node testsuite/properties

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using Element Should Not Exist would be better than checking error message.

Comment thread atest/robot/output/xunit.robot Outdated
[Arguments] ${source}
${properties} = Get Elements ${source} properties
Length Should Be ${properties} 1
[Return] ${properties}

@pekkaklarck pekkaklarck Jan 19, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can use new RETURN here and in the above keyword instead of [Return].

@pekkaklarck

Copy link
Copy Markdown
Member

Apparently #4193 has replaced this PR.

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