Test naming - Resharper and xUnit
In R # 8.2.0 and VS2013.3, the test runner I would like to group by sign like in the VS test runner:
Question: Can I get R # showing tests like this:
In R # the closest I can get this:
Security Code:
[Trait("Homepage", "User changes sort order to highest rating first")]
public class ChangeSortOrderToRating : IntegrationTestBaseWithData {
readonly JokeViewer viewer;
public ChangeSortOrderToRating() {
viewer = new JokeViewer(new Session());
}
[Fact(DisplayName = "Show all 3 Stories")]
public void ShowAllStories() {
List<Joke> result = viewer.ShowAllJokesHighestRatingFirst();
Assert.Equal(3, result.Count);
}
[Fact(DisplayName = "Show all Stories in rating order")]
public void ShowListOfStoriesInDescendingRankOrder() {
var result = viewer.ShowAllJokesHighestRatingFirst();
// 10,2,5 is order of insert in db
// First should be rating of 2
Assert.Equal(10, result[0].Rating);
Assert.Equal(5, result[1].Rating);
Assert.Equal(2, result[2].Rating);
}
}
R # extension for xUnit installation:
source to share
If you mean you want to avoid the method names in there, unfortunately right now, that's not realistic.
The way the ReSharper plugin works with xunit 1.x means that the display name is not available until the test is run (since the plugin uses the xunit API to find tests, but the property DisplayName
cannot be called due to what it is looking for source code, not compiled code.can DisplayName
do something with the code (e.g. attributes Theory
add information about parameters), so it makes no sense to use when building tests from code.
I hope the xunit 2.x support will fix this. 2.x goes to great lengths to ensure that all information can be obtained from source code analysis, so the xunit API can invoke reflection-like abstraction to get all the information, including a nice display name. Support for 2.x is currently supported, with tests working well, but still using xunit 1.x for test detection.
source to share