Add xunit support for .net core

I’ve been doing some research on how to correctly set up a website & deployment in Continua CI. So far everything is going fine, and now hitting the unit test part. From what I understand, the “best” way to unit test (asp) .net core apps is to use XUnit. I am following this guide:

https://xunit.github.io/docs/getting-started-dotnet-core.html

Continua CI already has an XUnit action, which is great. However, for .net core, it will (probably) need:

1. An additional property collector (xunit.dotnetcore)
2. Allow installation of xunit 2.2 (beta 2 for now) checkbox

I know it’s early days for .net core, but it would be great if this could be added to Continua CI.

Hi Geert,

You can already run XUnit tests on .Net Core projects using the new DotNet Test action in 1.8.1 beta. You need to add the following to your project.json file:

“dependencies”: {
        “xunit”: “2.2.0-beta2-build3300”,
        “dotnet-test-xunit”: “2.2.0-preview2-build1029”
 },
 “testRunner”: “xunit”
  
 As the dependencies can be restored using a DotNet Restore action, we don’t think there is any need for additional property collectors. 
 
 To get the results into Continua CI you need to add the Test Runner Argument e.g. “-xml $Workspace$\test-output.xml”, then add an Import XUnit Tests action pointing the test-output.xml file. 
 
 The dotnet test does not currently have a command line argument to allow us to specify the testRunner (without editing the project.json file) so it’s not really practical to run dotnet test from the XUnit Action. 


 

Thanks a lot for your detailed reply. I will soon try this out (had to battle quite some tools to support .net core on them all). Taking the last hurdles to automatically deploy npm packages, once that is done I can finish this one as well.