Skip to content

Request:Make "rebot.py" to parse incomplete output.xml files #2237

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

Closed
jetcar opened this issue Nov 26, 2015 · 8 comments
Closed

Request:Make "rebot.py" to parse incomplete output.xml files #2237

jetcar opened this issue Nov 26, 2015 · 8 comments

Comments

@jetcar
Copy link

jetcar commented Nov 26, 2015

We have to run test not using RIDE but using maven plugin, in this case HTML page will be generated at the end, it takes much time and very often happens some exceptions, like out of memory, or pc just get blue screen, or just some test fail and i dont want to wait until whole suit will be tested just stop it and see what was wrong, but in this case output.xml file is incomplete, and rebot.py can't parse it. Is it possible to parse output.xml file using rebot.py when xml file is incomplete?
I have made simple java application which can make simple html page from xml, but when xml is big then html page will be too big and it wont work properly, have also tried parse xml from javascript, and generate page, but xml parsing library is not perfect and can't properly handle big xml files, i want to edit rebot.py, but i'm not good at python so i still haven't found the right place to do that.
Can someone show the right place or the way how to do it?

@HelioGuilherme66
Copy link
Member

I have found XML repairing code in Python, and for some testing I did, it worked with a large output (20MB). But it will need to have better fault detection for some cases like XML element not complete.
About the development strategy, I think is better to create an independent tool and then incorporate with rebot. Would you like to share your Java code? We could translate to Python and/or expand to a better tool.
If @pekkaklarck approves this strategy, this is my proposal:

  • The tool completes an XML output with missing closing elements.
  • At the start (or near) of the XML fault, would introduce an output element with something like, "INFO: WARN: This report was recovered from a broken XML output!"
  • Changes to rebot:
    1 - Capture first failure to process XML output and triggers repariring tool.
    2 - Process repaired XML output.
    3 - If still failed to process, stops with error (as is doing now)

@pekkaklarck
Copy link
Member

I don't think Rebot should automatically try to fix outputs. We do, however, already have Fixml that does it: https://pypi.python.org/pypi/robotfixml.

@HelioGuilherme66
Copy link
Member

Great!
So this feature request could be changed just to an improvement of the failure message at rebot.
It could give the error and recommend to install and use that tool.
Do you want me to propose a code change?

@pekkaklarck
Copy link
Member

Mentioning Fixml in the error message when the output.xml is broken is a good idea.

@HelioGuilherme66
Copy link
Member

I took a look at the tool and it uses BeautifulSoup 3 (which has been replaced by version 4). Tested with both versions (version 3 is slower, version 4 complaints about deprecated class). I have found a simpler tool, because robotfixml introduces one more dependency, is a Robot Framework output format specific, and has more complexity. A very first draft is at https://github.com/HelioGuilherme66/xml_repair_tool.

@pekkaklarck
Copy link
Member

Yeah, Fixml is Robot specific on purpose. In addition to fixing xml it also tries to make it Rebot compatible.

It was created when there only was BeatifulSoup 3. Should update it to use v4 and also make it Python 3 compatible. I won't have time to look at it in the near future, but PRs are welcome.

I guess this issue can be closed. A separate issue and pr can be opened about mentioning Fixml in Rebot's invalid xml error message.

@myjniak
Copy link

myjniak commented Jul 7, 2020

I don't think Rebot should automatically try to fix outputs. We do, however, already have Fixml that does it: https://pypi.python.org/pypi/robotfixml.

As far as this Rebot method should not autofix the output.xml file, fixing could easily be an optional argument with False as default.
I saw this robotfixml lib recently and not gonna lie... it made me laugh :P

@HelioGuilherme66
Copy link
Member

@myjniak Nice for you to comment on a closed issue from 2015. Do you have any improvement to propose, in the form of code?

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

No branches or pull requests

4 participants