I was recently asked for help getting xunit test to run using
VSO build vNext. In this post I will walk you through how I was able to get
I created a simple Class Library project and added it to
source control. Make sure and choose a Windows - Class Library and not a Web
Class Library (Package).
Now using Nuget Package Manager add a reference to xunit and
xunit.runner.visualstudio. To the class1.cs file add a using for Xunit and add
a test method.
Run the test and makes sure it passes.
Now check in your changes so we can configure the build.
Navigate to VSO and the Build Hub. Add a new build using the Visual Studio
Update the solution path on the Visual Studio Build
step and update the Mappings on the Repository tab. Now return
to the Build tab so we can correct the Visual Studio Test step to
run our xunit test. The key to getting the xunit test to run is setting the Path
to Custom Test Adapters value under the Advanced section. The value
has to point to the folder under the Packages folder that contains the xunit
test adapter. I used the following path:
Now simply save and queue your build.