You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to import the xunit file generated by robot in a Polarion (Siemens) instance and reported an error on the timestamp format:
2022-06-22 11:26:54,985 [Worker-1: Import of test results to Test Run 0 -non-reg | u:a.m | job: xUnitFileImport] ERROR root - Sorry, there was an error processing xUnit file unit.xml: java.text.ParseException: Unparseable date: "2022-06-21T12:51:45.440000+0000"
java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2022-06-21T12:51:45.440000+0000"
at com.polarion.alm.tracker.internal.testing.XUnitFileProcessor$CreateHandler.startElement(XUnitFileProcessor.java:205)
I'm not sure weither the issue is caused by the Polarion or by the robot but I can propose a pull request to bypass it in the src/robot/reporting/xunitwriter.py
This seems to be a bug in Polarion rather than in Robot. When timestamps were added in RF 5.0 (#4074), we decided to use the same 2021-11-01T10:02:24.107000 format that PyTest uses and that is also ISO-8601 compatible. Could you report this to Polarion and see what they think about it? I'm sure there are also other tools out there than Robot Framework and PyTest that they aren't compatible with if they don't support ISO-8601.
The real root cause for this issue is the fact that there is no official standard for the xUnit file format.
We obviously could make Robot's xUnit output compatible with Polarion by dropping fractions of seconds. I don't think that's a good idea, though, because some consumers of these outputs may be interested in this information. It ought to be as easy to change Polarion so that it accepts valid ISO-8601 values and just throws away fractions if it doesn't need them.
If this cannot be fixed in Polarion, a workaround for you is modifying the xUnit output file produced by Robot yourself or generating a custom one based on output.xml.
Hi @cladstrife911,
I am writing xunit modifier which tackles problems like this. It is soon ready for publication. If you are interested, I could invite you to try it. Just let me know.
Do you know do they have some source to backup the claim that 2021-07-12T17:55:34+0200 is the correct formatting? As I wrote above, a problem here is that AFAIK there's no official xUnit format standard, but the ISO-8601 accepts fractions of seconds and I also find them useful. It ought to be easy to update Polarion so that it supports them. It's much harder to get different tools to produce exactly the format they want.
Hi,
Polarion is referring to JUnit schema which is maintained here.
<xs:simpleTypename="ISO8601_DATETIME_PATTERN">
<xs:restrictionbase="xs:dateTime">
<xs:patternvalue="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}"/>
</xs:restriction>
</xs:simpleType>
...
<xs:attributename="timestamp"type="ISO8601_DATETIME_PATTERN"use="required">
<xs:annotation>
<xs:documentationxml:lang="en">when the test was executed. Timezone may not be specified.</xs:documentation>
</xs:annotation>
</xs:attribute>
Seems that timezone information is not favored. I think, to tackle this timezone problem I could write the Polarion variant of xunit output modifier. @cladstrife911 would you like to test that?
The restricting regexp is buggy because it doesn't accept fractions of seconds or timezone which are both part of the ISO-8601 that it claims to support. AFAIK xs:datetime itself would support ISO-8601 so a simple fix would be removing the whole regexp. The problem is, again, that there's no official xUnit XML standard.
When such a standard is missing, it's especially important that tools follow the robustness principle and "be liberal in what you accept". It could be argued that Robot (and PyTest) should "be conservative in what they do", but not including a fractions of seconds would loose information and I don't think that's a good idea.
Activity
pekkaklarck commentedon Jun 22, 2022
This seems to be a bug in Polarion rather than in Robot. When timestamps were added in RF 5.0 (#4074), we decided to use the same
2021-11-01T10:02:24.107000format that PyTest uses and that is also ISO-8601 compatible. Could you report this to Polarion and see what they think about it? I'm sure there are also other tools out there than Robot Framework and PyTest that they aren't compatible with if they don't support ISO-8601.The real root cause for this issue is the fact that there is no official standard for the xUnit file format.
pekkaklarck commentedon Jun 22, 2022
We obviously could make Robot's xUnit output compatible with Polarion by dropping fractions of seconds. I don't think that's a good idea, though, because some consumers of these outputs may be interested in this information. It ought to be as easy to change Polarion so that it accepts valid ISO-8601 values and just throws away fractions if it doesn't need them.
If this cannot be fixed in Polarion, a workaround for you is modifying the xUnit output file produced by Robot yourself or generating a custom one based on output.xml.
cladstrife911 commentedon Jun 22, 2022
Yes thx for your feedback and tips.
I'll report to Polarion and probably create my own xunit file.
rikerfi commentedon Jun 23, 2022
Hi @cladstrife911,
I am writing xunit modifier which tackles problems like this. It is soon ready for publication. If you are interested, I could invite you to try it. Just let me know.
Meanwhile, I made it public: https://github.com/rikerfi/robotframework-xunitmodifier
I think, your interest goes here: https://github.com/rikerfi/robotframework-xunitmodifier/blob/86b38bff186a5cf7ad2ee28454d2b323c9a827dc/xom.py#L152
cladstrife911 commentedon Jun 28, 2022
Thx I wll have a look.
pekkaklarck commentedon Jun 28, 2022
Did you get any comments from Polarion?
cladstrife911 commentedon Jun 30, 2022
Hello, If you search for "xunit" in the document below you can find an example for the expected format:
https://almdemo.polarion.com/polarion/help/index.jsp?topic=%2Fcom.polarion.xray.doc.user%2Fguide%2Fxid1570730.html)
pekkaklarck commentedon Jun 30, 2022
Do you know do they have some source to backup the claim that
2021-07-12T17:55:34+0200is the correct formatting? As I wrote above, a problem here is that AFAIK there's no official xUnit format standard, but the ISO-8601 accepts fractions of seconds and I also find them useful. It ought to be easy to update Polarion so that it supports them. It's much harder to get different tools to produce exactly the format they want.rikerfi commentedon Jul 1, 2022
Hi,
Polarion is referring to JUnit schema which is maintained here.
Seems that timezone information is not favored. I think, to tackle this timezone problem I could write the
Polarionvariant ofxunit output modifier. @cladstrife911 would you like to test that?pekkaklarck commentedon Jul 1, 2022
The restricting regexp is buggy because it doesn't accept fractions of seconds or timezone which are both part of the ISO-8601 that it claims to support. AFAIK
xs:datetimeitself would support ISO-8601 so a simple fix would be removing the whole regexp. The problem is, again, that there's no official xUnit XML standard.When such a standard is missing, it's especially important that tools follow the robustness principle and "be liberal in what you accept". It could be argued that Robot (and PyTest) should "be conservative in what they do", but not including a fractions of seconds would loose information and I don't think that's a good idea.
cladstrife911 commentedon Jul 13, 2022
Polarion added a ticket to their backlog to fix this issue.