The Allure Adaptor for Robot Framework is a Library that can be included in the Robot scripts to generate Allure compatible XML files which can then be used to generate the Allure HTML reports. These reports provide a clear and dynamic overview of the status of the test run through several graphs and a time line overview of the run itself.
- Steps in Allure Framework are aligned to Keyword in Robot Framework.
- Test Suites map to Allure Test Cases are the same at both xml formats of Robot Framework and Allure.
- Feature and Stories are implemented as robot framework Tags story:name and feature:name format.
- External Issues Id's are supported as Robot Framework tags and an option to define a regular expression for their recognition.
- Link to the Issue Management system (For example JIRA) can be configured.
- The Allure adapter output is on top of the standard Robot Framework and does not replace it.
- Initialisation is done as a Robot Framework Library or as a Command Line Listener. Listener is preferred over the Library when in conflict.
- Parallelisation is supported, both manually started Robot Framework instances as well as using Pabot (version 0.32+).
- Supports overriding of Test Case status with: failed, broken, canceled, pending or passed by using Tags.
- Extends the number of Severity options to: blocker, critical, normal, minor or trivial through use of Robot Framework Tags
- The Allure Library is compatible with the Libspec API used by editors as for example RED
- Supports nesting of keywords.
- Provides Robot Framwork Environment information in the Environment section (versions, CLI arguments, OS type).
- Screenshots created by the Selenium2Library are supported.
The Allure adapter for Robotframework has a number of requirements that need to be in place: - Python. In testing 2.7 has been used. - Allure Pytest Adaptor <https://github.com/allure-framework/allure-python>
who'se foundation Python classes are used. It will be installed if not present.
- Robot Framework versions 2.8.5 and 3.0 have been used in testing. Since Robot Framework can be installed outside of pip this is not automatically installed.
- Allure Command line <http://wiki.qatools.ru/display/AL/Allure+Commandline> is needed to convert the Allure adapter for Robot Framework output files to the final HTML format.
- The Allure command line application requires Java Runtime Environment of 1.7 higher to function properly.
Use PIP:
pip install robotframework-allurereport
Clone the project repository from GitHub. After that you can install the framework with:
python setup.py install
The Allure adapter can be started as Library from within a Robot Framework test suite or when Robot Framework is started as a command line switch.
Below is a example Robot Framework suite file. The AllureLibrary is added in the Settings section of the file. When it's loaded it adds the listener to Robot Framework.
Optionally an argument can be provided to have the Allure adapter store its files in a different folder from the normal Robot Framework log files.
Library AllureReportLibrary C:\\Temp\\Allure
Below a more complete example:
*** Settings ***
Documentation A test suite with a single test for valid login.
...
... This test has a workflow that is created using keywords in
... the imported resource file.
Resource resource.robot
Library AllureReportLibrary //var//lib//Allure
*** Test Cases ***
Valid Login
Open Browser To Login Page
Input Username demo
Input Password mode
Submit Credentials
Welcome Page Should Be Open
[Teardown] Close Browser
For enabling the Allure adapter for a large set of suites files or simply for prefer to switch it on when needed, specifying a listner on the command line is the recommended approach.
The Listener is a class in the AllureLibrary Python module and can be directly accessed as AllureLibrary.AllureListener or in case the module is not installed via PIP the full path to the AllureListner.py file.
The listener has 1 option argument to set the output folder. In the same way as the Library the full path to the folder where the files can be stored.:
robot --listener AllureReportLibrary.AllureListener;C:\\tmp\AllureLog\ C:\tmp\\RobotScripts
Another example but then for Pabot. Since it supports the regular Robot Framework command line switches as well the difference is small.:
pabot --processes 2 --listener AllureReportLibrary.AllureListener;C:\\tmp\AllureLog\ C:\tmp\\RobotScripts
The Allure Adapter for Robotframework adheres to the Allure Output Convention <https://github.com/allure-framework/allure1/wiki/Creating-Allure-Adapter#output-file-conventions>.
- Every XML file should be named like this: {UUID}-testsuite.xml, where {UUID} is a universally unique identifier.
- Every XML file should be valid when checked with the Allure schema.
- The output result of an Allure adapter should store not only XML files with information about tests, but also copies of all attached files.
- Every attachment file should be named like this: {HASH-SUM}-attachment.{EXT}, where {HASH-SUM} is the cryptographic hash sum of the file contents (e.g. MD5, SHA1, Whirlpool and so on), {EXT} is the file extension corresponding to the MIME type in the XML file. We require cryptographic hash sums in order to avoid storing files with duplicate content.
With logging being influenced by a lot of different factors the present state does not cover all options and permutations. Some notable examples that are slated for upcoming releases:
- Screenshots are saved as a copy of the screenshots generated from Robot Framework. This requires the regular logging to happen in parallel.
- Command line settings for criticality and non-criticality are currently not used.
- Suite Setup and Tear down may not behave as expected.
- Interaction between the Library and Listener is currently not possible. The Library on facilitates the initialisation, but not any interaction.
- Although maybe last, certainly not least: documentation.
Allure Adaptor for Robot Framework is open source software provided under the MIT License. This software depends on Allure Reporting and the Allure Python adapter. These two projects are also based on GitHub but are available under the Apache 2.0 license. Other dependent Python Modules are available but perhaps under other licenses.