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
{{ message }}
Repository navigation
xUnit outputs: Add timestamp attribute for testsuite elements #4074
This is definitely a valid enhancement. Having timestamps sounds like a good idea in general and being compatible with the junitparser module is important on its own right as well. Probably should enhance the current tests to use junitparser to make sure we stay compatible. The main problem with all xunit output enhancements is that there's no official schema for that format. Using junitparser a reference is a good idea in that sense as well.
This needs to be implemented together with #2982 and should also look at #3944 at the same time.
Seems that output.xml file is 'single source of truth' for xunit output file as well. Timestamp attribute could be parsed relatively easy from testsuite's starttime. That leads implementation options to consider:
We just 1:1 convert timestamp from testsuite's starttime. E.g. 20211101 10:02:24.107 becomes 2021-11-01T10:02:24.107
Adjust timestamp to isoformat precision rounded e.g. 20211101 10:02:24.107 becomes 2021-11-01T10:02:24.107000
We'll re-format output.xml starttime/endtime having full precision e.g. 20211101 10:02:24.107123 becomes 2021-11-01T10:02:24.107123
Something else?
I am not sure how breaking change option 3 is. Options 1 & 2 are Robot Framework 'flavors' anyway. So, I would keep compatibility to junitparser and choose option 2.
Compatibility with junitparser is very important so option 2 is clearly the best.
Changing output.xml timestamp format is a subject of a different issue. I doubt times below milliseconds really matter in acceptance testing (there's e.g. overhead by the framework itself), but we should at least consider switching to ISO 8601 format. I'd like to change how times are handled internally as well, but I doubt that's important enough to make it into RF 5.0.
I'd prefer ISO 8601, but any parseable timestamp would be fine for me, as we just started to look a the xunit report, and were kinda surprised, that timestamp was not included at all. We'd appreciate this feature, as quite important for reporting purposes.
Reacted by Roman Klos, Pekka Klärck and Honza Machala
As I commented #4144, we need to decide how to handle suites not containing start time. Typically suites have it, but at least when combining results with rebot the root suite doesn't. I believe alternatives are not having timestamp at all or having timestamp=''. I'd prefer the former because it makes it explicit you need to handle that case separately, but I guess always having a timestamp has its benefits as well.
I already tested that junitparser doesn't actually require the timestamp attribute. It can parse our current xunit.xml file just fine and the resulting TestSuite.timestamp will be None.
changed the title [-]Add timestamp attribute testsuite element in xunit output[/-][+]xUnit outputs: Add `timestamp` attribute for `testsuite` elements[/+]on Mar 22, 2022
Activity
pekkaklarck commentedon Sep 2, 2021
This is definitely a valid enhancement. Having timestamps sounds like a good idea in general and being compatible with the junitparser module is important on its own right as well. Probably should enhance the current tests to use junitparser to make sure we stay compatible. The main problem with all xunit output enhancements is that there's no official schema for that format. Using junitparser a reference is a good idea in that sense as well.
This needs to be implemented together with #2982 and should also look at #3944 at the same time.
rikerfi commentedon Oct 31, 2021
Hi, I would like to give a try for this one as well as #2982
pekkaklarck commentedon Nov 1, 2021
Great, go ahead!
rikerfi commentedon Nov 1, 2021
Seems that output.xml file is 'single source of truth' for xunit output file as well. Timestamp attribute could be parsed relatively easy from testsuite's starttime. That leads implementation options to consider:
20211101 10:02:24.107becomes2021-11-01T10:02:24.107isoformatprecision rounded e.g.20211101 10:02:24.107becomes2021-11-01T10:02:24.10700020211101 10:02:24.107123becomes2021-11-01T10:02:24.107123I am not sure how breaking change option 3 is. Options 1 & 2 are Robot Framework 'flavors' anyway. So, I would keep compatibility to junitparser and choose option 2.
Comments welcome!
aaltat commentedon Nov 1, 2021
I don't have strong opinion, but option 2 feels best.
pekkaklarck commentedon Nov 2, 2021
Compatibility with junitparser is very important so option 2 is clearly the best.
Changing output.xml timestamp format is a subject of a different issue. I doubt times below milliseconds really matter in acceptance testing (there's e.g. overhead by the framework itself), but we should at least consider switching to ISO 8601 format. I'd like to change how times are handled internally as well, but I doubt that's important enough to make it into RF 5.0.
ra100 commentedon Nov 8, 2021
I'd prefer ISO 8601, but any parseable timestamp would be fine for me, as we just started to look a the xunit report, and were kinda surprised, that timestamp was not included at all. We'd appreciate this feature, as quite important for reporting purposes.
pekkaklarck commentedon Nov 16, 2021
As I commented #4144, we need to decide how to handle suites not containing start time. Typically suites have it, but at least when combining results with
rebotthe root suite doesn't. I believe alternatives are not havingtimestampat all or havingtimestamp=''. I'd prefer the former because it makes it explicit you need to handle that case separately, but I guess always having a timestamp has its benefits as well.I already tested that
junitparserdoesn't actually require thetimestampattribute. It can parse our current xunit.xml file just fine and the resultingTestSuite.timestampwill beNone.Move xunit tests for `timestamp` with Rebot to Rebot's suite.
pekkaklarck commentedon Nov 29, 2021
Implemented in PR #4144 by @rikerfi. Thanks for contribution!
[-]Add timestamp attribute testsuite element in xunit output[/-][+]xUnit outputs: Add `timestamp` attribute for `testsuite` elements[/+]Add timestamp attribute testsuite element in xunit output (robotframe…