I know there is this question:
How can XUnit be configured to show just the method name in the Visual Studio 2015 Test Explorer?
I tried both the solution using XML and the JSON file but the name in Text Explorer Window is still the full name with the class. I want to display the method name only as its hard to read the fully qualified names.
Its stated on this site that you can configure using XML
Configuring xUnit.net with XML
but I can't make the effect I'm expecting happen. I've restarted VS 2017 after adding an app.config file in the test project, but still nothing. Is it different for VS 2017?
This method is decorated with the Fact attribute, which tells xUnit that this is a test.
To write a test you simply create a public method that returns nothing and then decorate it with the Fact attribute. Inside that method you can put whatever code you want but, typically, you'll create some object, do something with it and then check to see if you got the right result using a method on the Assert class.
The xUnit.net test runner that we've been using supports . NET Core 1.0 or later, . NET 5.0 or later, and . NET Framework 4.5.
I had the same issue. I'm doing a project in VS2017 using .NET Standard and solved it by following these steps:
xunit.runner.json
{ "methodDisplay" : "method" }
xunit.runner.json
and select "Properties". Set Copy to Output Directory to "Copy Always".Taken from this comment.
W. Hampson answer is perfect, but just to inform about other possibility - use DisplayName attribute.
[Fact(DisplayName = "Just simple check")]
public void Check()
{
Assert.NotNull(_operation);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With