Search code examples
azure-devopsazure-pipelinesdevopspipelinebuild-pipeline

Where should I run tests at build or release pipeline?


I'm trying to set up a build and release pipeline, but I saw that it is possible to run visual studio tests in a build pipeline as well as in a release pipeline. Does anybody have a advice which one I should choose?


Solution

  • Where should I run tests at build or release pipeline?

    Indeed, just like the comment of 4c74356b41, it depends on what you test. In general, unit\ intergation on build. smoke \ UI on release.

    but is it also possible to run the unit tests at the release ?

    The answer is yes.

    According to the official document Visual Studio Test task:

    Use this task in a build or release pipeline to run unit and functional tests (Selenium, Appium, Coded UI test, and more) using the Visual Studio Test Runner.

    But, when you run the unit tests at the release pipeline, you need to use copy task and Publish build artifacts task to copy the dll and test.dll to the artifacts, so that we could get it in the release pipeline.

    enter image description here

    Then we could test it in the release pipeline.

    Check the similar thread for some more details.

    As test, it works fine on my side:

    enter image description here

    Hope this helps.