Skip to content

Generate full HTML report from Java Code Coverage (JaCoCo) XML in PowerShell

License

Notifications You must be signed in to change notification settings

constup/JaCoCo-XML-to-HTML-PowerShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Feb 5, 2025
d3a647f · Feb 5, 2025

History

17 Commits
Feb 4, 2025
Feb 4, 2025
Feb 5, 2025
Feb 5, 2025
Feb 4, 2025
Feb 4, 2025
Feb 5, 2025
Feb 4, 2025
Feb 4, 2025
Feb 5, 2025
Feb 4, 2025
Feb 5, 2025
Feb 4, 2025

Repository files navigation

JaCoCo XML to HTML in PowerShell

Support this tool

Ko-fi

Description

JaCoCo (Java Code Coverage) XML to HTML converter written in PowerShell.

JaCoCo is a popular code coverage format used by several languages and tools, including PowerShell’s Pester testing framework.

The best thing about this tool is - it’s all PowerShell. You don’t need to have Java or any other tool installed in order to generate an HTML report.

Showcase

statistics preview
code coverage preview

Key features

  • Pure PowerShell without dependencies

  • Code coverage statistics per group, package and source file

  • Source code coverage with colored lines, automatic source code language detection and syntax highlighting

  • All supported statistics are covered: instructions, branches, lines, complexity, methods and classes

  • Dark and light themes

  • Support for custom themes (Bootstrap or your own custom CSS)

  • Simple, but rich, well documented configuration (config file) with minimum mandatory fields - exactly 3: XML file, source code directory and HTML destination directory. The rest are pure customization options.

  • Easy integration with Pester

  • Mozilla Public License 2.0 (free and open source)

Installation

Prerequisites

Installation

Clone the repository:

git clone https://github.com/constup/JaCoCo-XML-to-HTML-PowerShell .

or download and unpack a release from Releases page

How to use

Configuration

In order to use this tool, you will need a configuration file. A commented-out configuration file (config.ps1.dist) is provided, so you can just copy it to your project and run JaCoCo-XML-To-HTML. Just remember to remove the .dist extension.

Mandatory configuration options are:

  • xml_file: the coverage report XML file;

  • destination_directory: where you want to save the HTML report. This directory must be empty. The directory will be created if it does not exist;

  • sources_directory: root directory where your project’s source code is (usually src/ directory in your project)

The rest of the configuration options are optional. Their description and documentation is available on the Configuration page.

Running

Once you have a configuration file with mandatory properties filled, everything is done by calling one command:

pwsh .\constup-jacoco-xml-to-html.ps1 --config /path/to/your/configuration/file

Themes and customization

By default, JaCoCo XML to HTML will create an HTML with a light theme. To generate a report with a dark theme, set the theme in your configuration file:

'theme' = 'dark';

More theme and customization options are available on the Configuration page.

More documentation

The following documentation is also available:

3rd party software licenses

This project uses and is bundled with the following 3rd party software:

Support

If you like this tool or find it useful, consider buying me a nice cup of coffee. Coffee fuels open source.

Ko-fi

License

Mozilla Public License 2.0 (also available on Mozilla’s website at: MPL 2.0)