When I run my tests today with xUnit v2, I typically use a naming convention like:
[Fact(DisplayName= "Method Will Do Something")]
public void Method_Will_Do_Something() { }
What extensibility point can I plug into that will allow me set my test display name based on the naming conventions of my test method?
The simplest way: Custom fact attribute, discoverer, and test case.
Example: https://github.com/xunit/samples.xunit/tree/master/RetryFactExample
For your custom test case, derive from
XunitTestCaseand override theInitialize()method. After callingbase.Initialize(), set theDisplayNameproperty appropriately.You can see the default behavior for
XunitTestCasehere: https://github.com/xunit/xunit/blob/master/src/xunit.execution/Sdk/Frameworks/XunitTestCase.cs