Package: robotframework-oxygen
OxygenOxygen is aRobot Frameworktool that empowers the user to convert the results of any testing tool or framework toRobot Framework's reporting. This consolidates all test reporting together regardless of tools used.Oxygen has built-in parsers for three testing frameworks:JUnit,Gatling, andZed Attack Proxy (ZAP).Oxygen is designed to be extensible. Users can create their ownhandlersfor other testing framework or tools to transform their reporting into the Robot Framework'slog.htmlandreport.html.Table of ContentsInstallationKeyword documentationUsageDeveloping OxygenLicenseAcknowledgementsInstallationTo install Oxygen, run the following:$ pip install robotframework-oxygenPre-requisitesOxygen is supported on Windows, Linux and MacOSPython 3.10or abovepipfor easy installationRobot Frameworkadditional dependenciesTo check the Python version on the command line, run:$ python --versionKeyword documentationKeyword DocumentationUsageExample: Robot Framework running other test toolsMain usage scenario for Oxygen is the ability to write acceptance test cases that run your tests in other test tools and integrate the resulting test report as part of Robot Framework's. This means you are able to run all of your testing from Robot Framework and thus having all test reporting consolidated together.After installing Oxygen, it can be used in the Robot Framework suite to write test cases. For example, to build acceptance tests that run different sets of JUnit tests:*** Settings ***Libraryoxygen.OxygenLibrary*** Test cases ***JUnit unit tests should pass[Tags]testset-1Run JUnitpath/to/mydir/results.xmljava -jar junit.jar --reports-dir=path/to/mydirJUnit integration tests should pass[Tags]testset-2Run JUnitpath/to/anotherdir/results.xmljava -jar junit.jar --reports-dir=path/to/anotherdirThen, run the suite by providing Oxygen asa listener:$ robot --listener oxygen.listener my_tests.robotOpening the Robot Frameworklog.htmlandreport.html, you should see that test caseJUnit unt tests should passhas been replaced by Oxygen with test cases matching with what is in thepath/to/mydir/results.xmlJUnit report file. Similarly, test caseJUnit integration tests should passhas been replaced with results frompath/to/anotherdir/results.xml; each JUnit test case with its relevant information has a counterpart in thelog.html. Each JUnit test case is also tagged with the tags from the original Robot Framework test case.The example above, for the brevity, shows incomplete commands to run JUnit tool from command line. Please refer tokeyword documentationfor more detailed documentation about keyword's arguments, as well as documentation forGatlingandZAPrelated keywords. And, of course, refer to the particular tool documentation as well.Using from command lineIn case where you want to run your other testing tools separately, but yet combine results into unified Robot Frameworklog.htmlandreport.html, you can use Oxygen's command line interface to convert single result file to single corresponding Robot Frameworkoutput.xml:$ python -m oxygen oxygen.junit my_junit_results.xmlAs a convention, the resulting Robot Framework xml file will be named by adding a suffix to the end. In the example above, the resulting Robot Framework xml file would be namedmy_junit_results_robot_output.xml.Notethat resulting xml file will also be created at the same location as the original result file. Therefore, when original result files are in another directory:$ python -m oxygen oxygen.gatling path/to/results.logThenresults_robot_output.xmlwill be created underpath/to/.Extending Oxygen: writing your own handlerRead the developer guide on how to write your own handlerYou might also want to look atspecification for handler resultsConfiguring your handler to OxygenOxygen knows about different handlers based on theconfig.ymlfile. This configuration file can be interacted with through Oxygen's command line.The configuration has the following parts:oxygen.junit:           # Python module. Oxygen will use this key to try to import the handler
  handler: JUnitHandler # Class that Oxygen will initiate after the handler is imported
  keyword: run_junit    # Keyword that should be used to run the other test tool
  tags:                 # List of tags that by default should be added to the test cases converted with this handler
    - oxygen-junit
oxygen.zap:
  handler: ZAProxyHandler
  keyword: run_zap
  tags: oxygen-zap
  accepted_risk_level: 2         # Handlers can have their own command line arguments
  required_confidence_level: 1   # See https://github.com/eficode/robotframework-oxygen/blob/master/DEVGUIDE.md for more information--add-configThis argument is used to add new handler configuration to Oxygen:$python-moxygen--add-configpath/to/your_handler_config.ymlThis file is read and appended to the Oxygen'sconfig.yml. Based on the key, Oxygen will try to import you handler.--reset-configThis argument is used to return Oxygen'sconfig.ymlback to the state it was when the tool was installed:$python-moxygen--reset-configThe commanddoes notverify the operation from the user, so be careful.--print-configThis argument prints the current configuration of Oxygen:$python-moxygen--print-config
Usingconfigfile:/path/to/oxygen/src/oxygen/config.yml
oxygen.gatling:handler:GatlingHandlerkeyword:run_gatlingtags:oxygen-gatling
oxygen.junit:handler:JUnitHandlerkeyword:run_junittags:-oxygen-junit
oxygen.zap:accepted_risk_level:2handler:ZAProxyHandlerkeyword:run_zaprequired_confidence_level:1tags:oxygen-zap

$Because you can add the configuration to the same handler multiple times, note that only the last entry is in effect.utilsmoduleInutils module, you will find assortment of functionalities that you might want to leverage when writing your own handler.run_command_line()Most of the time, handlers want to run the other test tool through command line. For this,utilsprovidesrun_command_line()that wraps Python'ssubprocessmodule for more easier to use when writing your handler.run_command_line()takes following arguments:cmd: the command to be executed in a subprocesscheck_return_code: if set toTrue, will raise an exception if thecmdfails in the subprocess.Notethat this fails the keyword and, thus, the execution of the test case is stopped. If you want to enable test case to continue even afterrun_command_line()has failed, you should disable it by settingFalse. It is often a good idea to allow user using your handler's keyword to decide how they want the command line execution to affect the test caseenv: a dictionary of environment variables that should be passed to the subprocess. By default,run_command_line()inherits the environment from the current Python process as well as from modifications done by the Robot Framework command line arguments (ie.--pythonpath)Developing OxygenClone the Oxygen repository to the environment where you want to the run the tool.Oxygen requires a set of dependencies to be installed. Dependencies are listed in therequirements.txtfile:$ pip install -r requirements.txtOxygen uses task runner toolinvoketo run tests, build the project, etc.Please refer to the available tasks for the project:$ invoke --listand the task filetasks.py.LicenseDetails of project licensing can be found in theLICENSEfile in the project repository.AcknowledgmentsOxygen tool was developed by Eficode Oy as part ofTestomat projectwith funding byBusiness Finland.