Wednesday, 9 March 2016
Run xUnit Unit Tests for (dnx)ASP.Net 5 with VS Team Services Build
To run the xUnit unit tests developed for ASP.Net 5 (ASP.Net Core 1.0 now), you need to setup a powershell step/task. Setting up a build with VS Team Services, for ASP.Net 5 is explained here.
First thing we need is a powershell script, which can runt xUnit tests, in VS Team Services build. (Hardcoded paths and project names in the script)
Check this script in.
We have to make sure test results are available to publish in the build. for that we can change the test project .json to create a results xml.
Next add a powershell script task/step to the build. Set the script to execute and let it continue on error, to make sure, it will not break the build on a test failure.
To publish the results, use “Publish Test Results” step. Set the test results xml file name specified in the project .json, for the results files. Select the Test result format as XUnit.
Once a build queues it executes the test and publish the results.
When there are multiple tests running in the build, a detailed test report helps to identify which tests fail.