Skip to content

[Engineering task] Protect a branch using a code coverage policy #4936

@gladjohn

Description

@gladjohn

Task type

Engineering excellence

Description

Visibility of code coverage in pull requests help developers and reviewers ensure that new code is tested. When differential code coverage is enabled for pull requests, reviewers can see which branches lack unit test coverage. This also helps prevent the introduction of untested code in a legacy repository, effectively stopping the “bleeding.” Note that, it doesn’t guarantee that the tests covering the code are effective, only that the code is covered by some test.

Guidance : https://eng.ms/docs/microsoft-security/identity/identity-productivity/quality/test/unittest/enablecodecoverageinprs

Code coverage status check for pull requests is only a suggestion for developers and it doesn't prevent pull requests with low code coverage from being merged into the target branch. To prevent developers from merging changes that don't meet a coverage threshold, you must configure a branch policy using the coverage status check.

Solution

more info here : https://learn.microsoft.com/en-us/azure/devops/pipelines/test/codecoverage-for-pullrequests?view=azure-devops#protect-a-branch-using-a-code-coverage-policy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions