4
votes

I have an Azure DevOps build pipeline that has been working for a long time.

Here is how I set it up:

Build pipeline

The pipeline contains the Restore, Build, Test & NuGet Packaging & Publish steps.

As it can be seen in the screenshot, the integration tests have been deactivated because they take some time to complete. So, I would like to move the execution of the integration tests to a release pipeline along with the NuGet Publish steps.

I do not see how I can run these integration tests in such pipeline. I thought calling dotnet test would work however it does not work: the command requires a .csproj file, not the built DLL. And, at this stage, the Release pipeline has to work in the artifact provided by the Build pipeline.

Release pipeline

As suggested in the comments, I see that dotnet vstest could be used but the option is not available on devops:

dotnet options

Question

How can I run my integration tests in an Azure DevOps Release pipeline?

1
I think you need to use dotnet vstest instead docs.microsoft.com/en-us/dotnet/core/tools/… it accepts a list of DLLs to run tests from. If using something like xunit, I believe you need to have the associated vstest runner referenced by the test project. - pinkfloydx33
@Kzrystof One thing i forgot to mention, you can add a Publish build artifacts ** to publish the build dll files to release pipeline where you can run your test with **Visual Studio Test task. I updated my answer. hope it can be helpful. - Levi Lu-MSFT
@LeviLu-MSFT I will try this and mark the answer as Accepted. - Kzrystof
@Kzrystof Great. Thanks! - Levi Lu-MSFT

1 Answers

3
votes

In order to test the test.dll files in release pipeline, You can add a publish build artifacts task right after your dotnet build task. Then you can test your test dlls in your release pipeline with Visual Studio Test task. enter image description here

To run a custom dotnet command, You can specify the command to run in option Custom command

enter image description here

Suggested:

However there is another test task (Visual Studio Test) can run .dll.

enter image description here