Commit 2eca4684 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

Added self-written script "Tools/" to include it into GitLab CI pipeline.

parent 34e6bb13
# Collect HTML coverage reports (created by Maven's jacoco plugin) and average the result of all moduls.
# Use top-level pom.xml to look into correct subdirectories.
# Wach out: call this script from root directory of project. E.g.
# python Tools/
import xml.etree.ElementTree as ET
import os
import re
def get_modules_from_pom_file(filename="pom.xml"):
xml_name_spaces = {
"default": ""
xml_tree = ET.parse(filename)
xml_root = xml_tree.getroot()
exclude_list = ["VadereAnnotation"]
modules = xml_root.findall("default:modules/default:module", xml_name_spaces)
module_names = [module.text for module in modules if module.text not in exclude_list]
return module_names
def read_coverage_data_for_modules(module_names):
module_to_coverage = dict()
default_coverage_file = "target/site/coverage-reports/index.html"
for module in module_names:
coverage_path = os.path.join(module, default_coverage_file)
with open(coverage_path, "r") as file:
coverage_report =
regex_pattern = re.compile(r"Total.*?([0-9]{1,3})%")
match =
if match:
module_to_coverage[module] =
raise Exception("Coverage data not found for module: {}".format(module))
return module_to_coverage
if __name__ == "__main__":
module_names = get_modules_from_pom_file()
module_to_coverage = read_coverage_data_for_modules(module_names)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment