Testing .NET Core with Team Foundation Server

Testing .NET Core projects as part of a build in Team Foundation Server is relatively easy – just add a Test .NET Core task – but collecting and publishing the results so that they can be viewed in the UI is a bit trickier. Since I’m using XUnit as testing framework, I tried using their dotnet xunit command, but it didn’t work. After some searching and experimenting, I came up with the following solution.

  1. Add the following arguments to the Test .NET Core task:
    –no-restore –no-build –configuration $(BuildConfiguration) –logger trx
    The important part here is the logger parameter.
  2. Add a Publish Test Results task with the following options:
    Test Result Format: VSTest
    Test Result Files: **/*.trx

That’s it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.