Hello everyone, I am facing an issue with dbbot-sql library that I’m unable to solve. The basic command python -m dbbot.run atests/testdata/one_suite/test_output.xml
gives me the following error:
File "C:\Users\.....\AppData\Local\Programs\Python\Python311\Lib\site-packages\dbbot\reader\robot_results_parser.py", line 35, in xml_to_db suite_metadata = list(test_run.suite.metadata.values())[0] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range
The result-parser py file contains this function (last line is 35):
I am not very good at debugging Python so I have not been able to figure out the problem, can anyone give a hint what should I try? Alternatively, is there any other solution to serialize RF output to a mysql database?
xml_file you are passing to xml_to_db is not found. Try passing an absolute path not relative.
EDIT; Nah, that wasn’t it, i was running example code with actual output.xml and not expecting it was there …
This feels like its a bit of compatibility issue … If i execute somewhat similar code with a testsuite that does not have any metadata associated with it - i get same error as you mentioned (different place but same error) …
If i add Metadata into Settings section, code works…
Which definitely feels like the dbbot should handle but its just expecting that there has to something there with [1] on the list …
So, the “fix” would be to add something like this into your suite:
*** Settings ***
Metadata foo bar
And then file a bug report to who ever maintains that parser…
Thank you for the response, adding metadata solved that problem but didn’t work for me yet, which dbbot library are you using? There seems to be several, I’m using dbbot-sql specifically, that seems to be most recent I could find.
The last error I got is the following (using dbbot-sql):
sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) Error binding parameter 4: type
'WindowsPath' is not supported
[SQL: INSERT INTO suites (suite_id, xml_id, name, source, doc, metadata) VALUES (?, ?, ?, ?, ?, ?)]
[parameters: (None, 's1', 'TC-10', WindowsPath('u:/Github/ < my path> /TC-10.robot'), '', '')]
(Background on this error at: https://sqlalche.me/e/20/f405)
It seems to not like the “source” value, didn’t yet figure out a solution to this.
EDIT: I managed to get it working by assigning a static “test” value for the source variable in _parse_suite function in robot result parser. Not sure what will that break along the line but I’ll keep testing.