Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Collapse long failure messages in log and report #4931

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

Open
pekkaklarck opened this issue Nov 6, 2023 · 3 comments
Open

Collapse long failure messages in log and report #4931

pekkaklarck opened this issue Nov 6, 2023 · 3 comments

Comments

@pekkaklarck
Copy link
Member

pekkaklarck commented Nov 6, 2023

Currently long failure messages (over 40 lines by default, configurable with --max-error-lines (#2576)) are cut from the middle. This is done to avoid huge messages messing up logs and reports, but the problem is that some valuable information may be lost. Another issue is that even the resulting messages are somewhat long and take lot of space.

The above is an old problem, but the situation is getting worse in RF 7.0 due failure messages being shown not only with tests,but also with each keyword and control structure. Earlier keywords and control structures in the result model didn't have a message at all, but it was added as part of the result model cleanup (#4883). The motivation was this:

  • We are adding JSON representation to the result model (Support JSON serialization with result model #4847) and want the model to be as stable and future-proof as possible.
  • We likely want to in the future allow running individual keywords outside Robot core. At that point we want the result model to have a message, not only status as earlier.
  • In some special cases (at least with --flatten-keywords and --remove-keywords) we want to add some extra notes to result objects. Earlier we used documentation for that, but it was odd because control structures such as FOR loops cannot otherwise have a documentation. Using the message for this purpose works much better.

Now that also keywords and control structures also have a message, the same message can be shown on multiple levels in the log file. That's rather annoying in general, but gets especially irritating if the message is long. To mitigate this issue, and to fix the old issue with long messages, I propose we do the following:

  1. Show only the beginning of long failure messages in log and report by default. I believe we should show so much that typical messages are shown fully, but considerably less than 40 lines that is the current maximum. We could possibly also show more with tests than with keywords and control structures.
  2. Have some way to show the full message. Probably a simple "Show more." button/link would be fine.
  3. Stop cutting long messages otherwise. This can increase output file sizes, but I doubt the difference is too big.
@pekkaklarck
Copy link
Member Author

pekkaklarck commented Nov 6, 2023

If implementing this turns out to be too big a task in RF 7.0, we need to decide how to otherwise solve the issue with the same failure message being shown with tests, keywords and control structures in the log file. It would be easy to include the failure message only with tests, but then the extra notes added with --flatten-keywords and --remove-keywords wouldn't be shown either. Including only these extra notes could work, but parsing messages to find them would require some extra work.

pekkaklarck added a commit that referenced this issue Nov 6, 2023
Issue #4883 added `message` to keywords and control structures in the
result model and they were also added to the log file. With nested
structures, it is possible that multiple keywords or control
structures have the same message that is also shared by the test
case. This is somewhat annoying in general and especially problematic
with longer messages.

This commit removes writing normal keyword and control structure
messages to the log file. Only messages that are written are notes
about keywords being removed or flattened with `--remove-keywords` or
`--flatten-keywords`. These notes are now wrapped with `<span
class="robot-note"></span>` to make it possible to recognize them.

Issue #4931 proposes collapsing long messages in log and
report. If/when that's implemented, we can consider including also
keyword and control structure messages in the log file.
@pekkaklarck
Copy link
Member Author

The above commit removed writing normal keyword and control structure messages to the log file. Only messages that are written are notes about keywords being removed or flattened with --remove-keywords or --flatten-keywords. This basically returns us to the situation we had before the result model cleanup (#4883).

Collapsing long messages would still be convenient, but it doesn't have such a high priority. If it is done, we can consider including also keyword and control structure messages in the log file again. They may be annoying even if they are collapsed, though.

@pekkaklarck
Copy link
Member Author

As explained above, the situation is now the same as earlier. We are running out of time with RF 7.0 so moving this forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant