/allure-docx

docx report generation based on allure-generated json files

Primary LanguagePythonMIT LicenseMIT

allure-docx

DOCX and PDF report generation based on allure-generated result files.

Limitations

  • This was only tested so far using results from allure-pytest. Therefore it expects a folder with .json files generated by the allure plugins.

Check the issues on the repository to see other current limitations.

Questions

Feel free to open an issue ticket with any problems or questions. Please if possible provide your test result files so we can debug it more efficiently.

Installation

Windows

We publish windows standalone executable files. With them you can use it without having to install anything else other than the cairo dlls, meaning no installing python, etc.

You can download them at: https://github.com/typhoon-hil/allure-docx/releases

Then you can use the executable directly (possibly adding it a folder added to PATH).

Linux

You can install from source using:

pip install git+https://github.com/typhoon-hil/allure-docx.git

Then you should be able to use allure-docx executable like you use pip.

Usage

Check usage by running allure-docx --help

You can generate the docx file by running allure-docx ALLUREDIR filename.docx

Use the --detail-level option to control level of detail in the docx report (e.g. print all steps or not). Check the help for available levels.

The generated docx contain a Table of Contents that needs to be manually updated after generation. Generating PDFs (see below) will automatically update the TOC though.

PDF

The --pdf option will search for either OfficeToPDF or LibreOfficeToPDF application in the PATH to generate the PDF.

On Windows, PDFs can be generated from generated docx files using OfficeToPDF application. MS Word needs to be installed.

https://github.com/cognidox/OfficeToPDF/releases

On Windows and Linux, PDFs can be generated using LibreOfficeToPDF application. LibreOffice should be installed.

https://github.com/typhoon-hil/LibreOfficeToPDF/releases

If both OfficeToPDF and LibreOfficeToPDF are present, OfficeToPDF will be used.

Custom Title and Logo

You can use the --title option to customize the docx report title.

If you want to remove the title altogether (e.g. your logo already has the company title), you can set --title="".

You can also use the --logo option with a path to a custom image to add the test title and the --logo-height option to adjust the height size of the logo image (in centimeters).

Example invocation:

allure-docx --pdf --title="My Company" --logo=C:\mycompanylogo.png --logo-height=2 allure allure.docx

Building the standalone executable

We use PyInstaller to create standalone executables. If you want to build an executable yourself, follow these steps:

  • Create a new virtual environment with the proper python version (tested using python 3, 32 or 64 bit so far)
  • Install using pip pyinstaller and ONLY needed packages defined in setup.py. This prevents your executable to become too large with unnecessary dependencies
  • Delete any previous dist folder from a previous PyInstaller run
  • Run the build_exe.cmd command to run PyInstaller and create a single file executable.

If having the following error:

ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

Run pip install --force-reinstall -U future (nipy/nipype#2646)