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
Result model: Add message to keywords and control structures and remove doc from controls #4883
Currently some control structures in the result model have a doc attribute that's represented in output.xml as a <doc> element. This attribute is used for storing information about removing or flattening items using --flattenkeywords and --removekeywords options. It's a rather strange attribute because it's not possible to set documentation for control structures in data. It's also also inconsistent that only some of the control structures have it.
On the other hand, control structures don't have a message attribute that would contain their possible failure message, they only have status. Keywords have in practice don't have message either. They do have the attribute, it is only used with teardowns to make possible to see the error message if a suite teardown fails.
To fix the above issues, we have decided to do the following:
Add message to all keywords and control structures and always store the possible failure message in it.
Use message also for storing information about flattening or removing items.
Remove doc from control structures.
The main benefit of these changes is making the result model simpler and more consistent. It is important in general, but it gets even more important now that we are adding JSON serialization support to it (#4847) and that format will likely be used also by external tools.
The doc attribute that control structures currently have won't be directly removed, but it will be deprecated as part of #4846. Old output.xml files with possible <doc> elements with control structures will still be supported. Whatever content <doc> contains will be added to message.
Although there are changes to output.xml, this issue shouldn't cause backwards compatibility issues.
We don't anymore write <doc> elements with control structures, but it was earlier written only if items actually had something in doc and thus tools processing outputs couldn't expect it to be present. It's actually more likely that some tools could have been confused if such a rare element would be there.
The new message attribute is written as a content of the <status> element. The element has existed with all items already earlier and has also had content with tests and suites (and keywords used as teardowns), so tools ought to handle it just fine.
Although there shouldn't be direct backwards compatibility issues, output.xml size will grow because now failure messages are stored with all keywords and control structures, not only with tests. We don't expect the change to be noticeable unless there are big number of failures. If this causes issues in practice, we can consider making it configurable to store messages to output.xml. Even without such configuration, a simple pre-Rebot modifier with following content can clear all messages:
The most visible change is that the failure message is visible with all keywords and control structures also in the log file. We are not sure is that desirable and may decide to hide it still before RF 7.0. Feedback related to that is appreciated!
Based on my experience with using the current development version of Robot for testing Robot itself, I feel that showing the error message with all keywords and control structures in the log file doesn't work too well. Especially with longer errors and deeper nested structures it makes finding the actually failed keyword harder.
It would be easy to not include message in the log file even though they are in the result model, but then extra information we add to the message at least with --removekeywords and --flattenkeywords would be lost as well. With keywords we could use doc instead, but these options also work with control structures that don't have doc. Removing it was one of the main motivations of this issue and it doesn't make sense to add it back.
A somewhat easy solution would be showing only the beginning of the error with keywords and control structures. We could either cut it when the JS model used by the log file is constructed or we could have some JavaScript code that hides the message and allows viewing it fully if needed. The latter solution would be nice, but it's also more work and because the full message is anyway visible where it actually occurred it's not that important.
Activity
pekkaklarck commentedon Oct 4, 2023
Although there are changes to output.xml, this issue shouldn't cause backwards compatibility issues.
We don't anymore write
<doc>elements with control structures, but it was earlier written only if items actually had something indocand thus tools processing outputs couldn't expect it to be present. It's actually more likely that some tools could have been confused if such a rare element would be there.The new
messageattribute is written as a content of the<status>element. The element has existed with all items already earlier and has also had content with tests and suites (and keywords used as teardowns), so tools ought to handle it just fine.pekkaklarck commentedon Oct 4, 2023
Although there shouldn't be direct backwards compatibility issues, output.xml size will grow because now failure messages are stored with all keywords and control structures, not only with tests. We don't expect the change to be noticeable unless there are big number of failures. If this causes issues in practice, we can consider making it configurable to store messages to output.xml. Even without such configuration, a simple pre-Rebot modifier with following content can clear all messages:
pekkaklarck commentedon Oct 4, 2023
The most visible change is that the failure message is visible with all keywords and control structures also in the log file. We are not sure is that desirable and may decide to hide it still before RF 7.0. Feedback related to that is appreciated!
pekkaklarck commentedon Oct 4, 2023
I guess the changes listed in the two comments above warrant adding
backwards incompatiblelabel to this issue anyway.Don't set message with BREAK, CONTINUE and RETURN.
pekkaklarck commentedon Nov 3, 2023
Based on my experience with using the current development version of Robot for testing Robot itself, I feel that showing the error message with all keywords and control structures in the log file doesn't work too well. Especially with longer errors and deeper nested structures it makes finding the actually failed keyword harder.
It would be easy to not include message in the log file even though they are in the result model, but then extra information we add to the message at least with
--removekeywordsand--flattenkeywordswould be lost as well. With keywords we could usedocinstead, but these options also work with control structures that don't havedoc. Removing it was one of the main motivations of this issue and it doesn't make sense to add it back.A somewhat easy solution would be showing only the beginning of the error with keywords and control structures. We could either cut it when the JS model used by the log file is constructed or we could have some JavaScript code that hides the message and allows viewing it fully if needed. The latter solution would be nice, but it's also more work and because the full message is anyway visible where it actually occurred it's not that important.
Don't add normal keyword or control structure messages to log.