About Code Coverage | Code Coverage | 0.2.3-preview
docs.unity3d.com
    Show / Hide Table of Contents

    About Code Coverage

    Use the Code Coverage package with the Test Runner to gather and present test coverage information. When you run your tests with code coverage enabled you can see exactly which lines of your code are executed when the tests run in addition to whether the tests passed or failed. See Using Code Coverage with Test Runner.

    Once a test run has completed, the Code Coverage package will generate an HTML coverage report showing which lines of your code are covered by tests. Code Coverage currently supports EditMode and PlayMode tests. It also allows you to track the code coverage changes through time.

    Additionally, the Code Coverage package offers a Coverage Recording feature which allows capturing coverage data on demand.

    The Code Coverage package is available as a preview package via the Package Manager for Unity 2019.3 and above. See Installing Code Coverage. Please make sure to enable preview packages in the Package Manager, otherwise it won't be listed.

    Coverage HTML Report

    Shown below is an example of the top level page of a HTML report generated by the package.

    HTML Report

    Class View

    HTML Report

    Coverage Summary Badge

    Additionally, the package can produce a simple badge showing the current percentage of code that is covered.

    Summary Badge


    Preview package

    This package is available as a preview, so it is not ready for production use. The features and documentation in this package might change before it is verified for release.

    In This Article
    • Coverage HTML Report
      • Class View
    • Coverage Summary Badge
    • Preview package
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023