问题
I am writing .Net 4.8 code and have MSTest tests in a single assembly dll. Using Azure Devops git as repository. The code in the branch should check-in only if all unit test PASS. Is it possible? I am also ok, if required, to use some script like powershell etc.. to help me enable this.
回答1:
you can use branch policies to force a specific build to run and succeed before PR can be merged. You have to create a build that runs those tests and configure branch policies to run that build (consult the link below to figure out how to do that exactly).
in short: go to branches, click 3 dots near branch and choose "branch policies". then configure build validation.
https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops#build-validation
来源:https://stackoverflow.com/questions/55891085/force-developer-to-run-unit-test-project-before-pr-is-raised-in-azure-devops