ReportGenerator

repository·main·Indexed 25 days ago

https://github.com/danielpalme/reportgenerator

A tool that converts code coverage report formats—including coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov, and lcov—into human-readable visualizations. It supports merging multiple coverage files into a single report and provides various output formats such as HTML, Markdown, Cobertura, and JsonSummary. ReportGenerator can be used as a .NET global tool, NuGet package, MSBuild task, Azure DevOps extension, or GitHub Action.

Tokens
8K
Snippets
17
Records
45
Agent score
84%

What's inside ReportGenerator

  1. Overview of ReportGenerator

    main

    ReportGenerator is a tool for powerful code coverage visualization. It converts coverage reports generated by various tools into human-readable reports in multiple formats. It also supports merging several coverage files into a single unified report.

    Supported input formats include:

    • coverlet
    • OpenCover
    • dotCover
    • Visual Studio
    • NCover
    • Cobertura
    • JaCoCo
    • Clover
    • gcov
    • lcov
  2. Choose the correct ReportGenerator package

    main

    Select the package that matches your platform and integration needs:

    • ReportGenerator: For .NET Framework or .NET Core projects using the command line or build scripts.
    • dotnet-reportgenerator-globaltool: For .NET Core projects where you want to use it as a global or local .NET Tool.
    • ReportGenerator.Core: For .NET Standard 2.0 environments where you need to write a custom plugin or call ReportGenerator directly within your own C# code.
  3. Use ReportGenerator.Core for custom plugins or programmatic execution

    main

    The ReportGenerator.Core package is intended for developers who need to extend ReportGenerator or integrate it directly into their own software. Use this package if you want to:

    1. Write a custom plugin for ReportGenerator.
    2. Call or execute ReportGenerator programmatically within your own codebase.

    For guidance on implementing custom reports or custom history storage, refer to the official wiki documentation.

  4. Install ReportGenerator for coverage report generation

    main

    If your goal is simply to generate coverage reports (rather than developing plugins or integrating the core logic), do not use the .Core package. Instead, use one of the following packages depending on your needs:

    • NuGet Package: Use ReportGenerator for integration into your projects.
    • dotnet Global Tool: Use dotnet-reportgenerator-globaltool to run ReportGenerator from the command line via the dotnet CLI.
  5. Use ReportGenerator in Azure DevOps Pipelines

    main

    You can use the reportgenerator@5 task in your Azure DevOps YAML pipelines to parse coverage reports and generate output in desired formats.

    Key Inputs:

    • reports: (Required) The coverage reports to parse (separated by semicolon; globbing supported).
    • targetdir: (Required) The directory where the generated report will be saved.
    • reporttypes: The output formats (separated by semicolon). Examples include HtmlInline_AzurePipelines, Cobertura, Html, JsonSummary, etc.
    • publishCodeCoverageResults: Set to true to directly publish the report in the 'Code Coverage' tab of Azure DevOps, making the separate PublishCodeCoverageResults task unnecessary.
    - task: reportgenerator@5
      displayName: ReportGenerator
      inputs:
        reports: 'coverage.xml' # REQUIRED
        targetdir: 'coveragereport' # REQUIRED
        reporttypes: 'HtmlInline_AzurePipelines;Cobertura'
        publishCodeCoverageResults: true
  6. Install dotnet-reportgenerator-globaltool

    main

    You can install the dotnet-reportgenerator-globaltool package in three ways depending on your environment requirements:

    1. Global Installation: Install it as a global .NET tool available anywhere on your system.
    2. Local Tool Path: Install it to a specific directory (e.g., tools) using the --tool-path flag.
    3. Tool Manifest: Install it as a local tool within a project using a tool manifest (recommended for project-specific version pinning).
  7. Run ReportGenerator via .NET Core

    main

    If you are using the ReportGenerator package on .NET Core, you can execute the tool by pointing to the DLL or EXE located in your NuGet packages folder. Replace [options] with your specific command line parameters.

    dotnet $(UserProfile)\.nuget\packages\reportgenerator\5.5.11\tools\net10.0\ReportGenerator.dll [options]
    $(UserProfile)\.nuget\packages\reportgenerator\5.5.11\tools\net10.0\ReportGenerator.exe [options]