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
Support JSON serialization with result model #4847
RF 6.1 added support to serialize the execution model (robot.running.TestSuite) into JSON and back (#3902). This support should be extended to the result model (robot.result.TestSuite) as well. Supporting writing results directly to a JSON file as part of execution is out of the scope of this issue (we already have #3423 about that), but Rebot should be able to produce output.json files.
A precondition for this issue is cleaning up the result model a bit. That includes removing deprecated attributes (#4846), enhancing how keyword names are stored (#4884) and enhancing timestamp handling (#4258).
The ModelObject base class that both running and result objects use got to_json and from_json methods already in RF 6.1 when JSON serialization support was added to the running model (#3902). Supporting to_json and from_json with the result model had a precondition that the result model should be cleaned up a bit (see issues referenced from the description), and after that all result model objects just needed their own to_dict. @yanne has implemented them (relevant commits don't seem to be linked to this issue) and they were already part of RF 7.0 beta 1.
The commit referenced above adds JSON support to Rebot so that both of these usages work:
Notice that the created output.json file only contains information about the executed suite, no statistics or errors like output.xml files contain. We probably should change that in the future when we add support to write output.json as part of execution (#3423). Robot's own functions and tools processing output.json files will, however, continue to support also files with only suite information.
This functionality still needs to be documented in the User Guide, but otherwise this issue is ready.
The JSON data format has a separate section in the User Guide. A similar section would be nice for the JSON result format as well, but it would also be a bit odd because we don't have such a section for the XML result format. I think we can consider result formats such information that it isn't needed by normal users and thus doesn't need to be documented in the User Guide. We can add something later, but then we should document both XML and JSON formats.
How to use create and process JSON output files with Rebot obviously needs to be documented.
Activity
Add "new in" notes to `ModelObject.to/from_dict/json` methods.
JSON output and input support to Rebot.
pekkaklarck commentedon Dec 18, 2023
The
ModelObjectbase class that both running and result objects use gotto_jsonandfrom_jsonmethods already in RF 6.1 when JSON serialization support was added to the running model (#3902). Supportingto_jsonandfrom_jsonwith the result model had a precondition that the result model should be cleaned up a bit (see issues referenced from the description), and after that all result model objects just needed their ownto_dict. @yanne has implemented them (relevant commits don't seem to be linked to this issue) and they were already part of RF 7.0 beta 1.The commit referenced above adds JSON support to Rebot so that both of these usages work:
Notice that the created output.json file only contains information about the executed suite, no statistics or errors like output.xml files contain. We probably should change that in the future when we add support to write output.json as part of execution (#3423). Robot's own functions and tools processing output.json files will, however, continue to support also files with only suite information.
This functionality still needs to be documented in the User Guide, but otherwise this issue is ready.
pekkaklarck commentedon Dec 19, 2023
The JSON data format has a separate section in the User Guide. A similar section would be nice for the JSON result format as well, but it would also be a bit odd because we don't have such a section for the XML result format. I think we can consider result formats such information that it isn't needed by normal users and thus doesn't need to be documented in the User Guide. We can add something later, but then we should document both XML and JSON formats.
How to use create and process JSON output files with Rebot obviously needs to be documented.
Document JSON output file support with Rebot. Fixes robotframework#4847.