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?
-
1depends on what test. unit\intergation on build. smoke\ui on release – 4c74356b41 Sep 30 '19 at 09:06
-
@4c74356b41 but is it also possible to run the unit tests at the release ? – Achraf C. Sep 30 '19 at 09:16
-
2well, no. because you'd need the code to run those, not binaries – 4c74356b41 Sep 30 '19 at 09:31
1 Answers
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.
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:
Hope this helps.

- 71,098
- 10
- 114
- 135
-
2I think it is better to run UI tests on build pipeline, you do not have to wait when you want to deploy. – Shadow May 04 '20 at 19:12