Important note: These directions are for testing desktop unit test assemblies only. In particular, these directions will not work for .NET Core.
xunit.runner.visualstudio
to at least one of your test projects.install-package xunit.runner.visualstudio
Visual Studio Test
.These instructions are written for Version 1.*
of the Visual Studio Test
task. You may need to change the version as it defaults to Version 2.*
or whichever is latest.
Execution Options/Test Assembly
, point to your generated test assemblies, e.g. **\bin\$(BuildConfiguration)\*test*.dll;-:**\xunit.runner.visualstudio.testadapter.dll
.Execution Options/Code Coverage Enabled
checkbox./InIsolation
under Advanced Execution Options/Other console options
.After a successful build, the test results are available on the main view of the build. It should look something like this:
You no longer need to manually configure the test adapter path, because Nuget restored test adapters are automatically searched for.
Sometimes you get this error one or many times
Warning: System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain. This can happen if the test(s) started a thread but did not stop it. Make sure that all the threads started by the test(s) are stopped before completion.
It is not related to VSTS and does not affect the results. For more information, see xUnit Issue 490 and MS Connect.