19

My VS test explorer shows tests including the full type name, like so:

CompanyName.ProjectName.Web.Tests.SutDoesWhatItShould

Instead of just:

SutDoesWhatItShould

This is highly unreadable/annoying. How do I fix this?

I'm using the xunit runner for visual studio (prerelease) and xunit.net.

Aage
  • 5,932
  • 2
  • 32
  • 57

2 Answers2

19

In v2 this is now configurable, see http://xunit.github.io/docs/configuration-files.html

So you need to add to app.config:

<appSettings>
    <add key="xunit.methodDisplay" value="method"/>
</appSettings>

and as noted in the comments, you might need to restart Visual Studio.

robi-y
  • 1,687
  • 16
  • 25
7

For .NET Core projects (with .json configuration):

  1. Add xunit.runner.json file to your test project with following contents: { "methodDisplay": "method" }
  2. Set Copy if newer from options for xunit.runner.json file you've just added
  3. Build the test project

For more information refer to the documentation.

Mert Akcakaya
  • 3,109
  • 2
  • 31
  • 42