Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

retain file [argument] order in test explorer #3260

AdmiralSnyder started this conversation in General
Discussion options

image As you can see in the screenshots, i'm using [Argument] to fill in test data. sadly, test explorer thinks that it's fine to sort the test cases, apparently, instead of retaining the order of tests from the file. is there something you can do about that? i.e. rendering an incrementing counter into the test case name?

so it would be CreateBoxStringTest #1 (0, 1, 1, 1, 1, a) ... ?

I'd hate to add an additional parameter there for the general case, and reordering my testcases is undesirable since the kinda tell a story, sometimes...

thank you.

You must be logged in to vote

Replies: 3 comments

Comment options

That'd be a hacky workaround.

The test explorer UI is owned by Microsoft / VS. So worth raising an issue with them.

You must be logged in to vote
0 replies
Comment options

i am quite sure that they do order those things on purpose, since the test explorer's columns can be sorted - i don't think we can convince them to change that behaviour (and i know that it wouldn't be implemented any time soonish :-P

image

this is the hacky workaround using a DisplayNameFormatter :-)
btw can i convince you to render a space after the method names before the parentheses in the default implementation of .GetDisplayName()? so i don't need the ugly .Replace?

public class OrderedArgumentsAttribute : DisplayNameFormatterAttribute
{
 static int Counter; // <-- hacky and probably bad, but works for now :-)
 protected override string FormatDisplayName(DiscoveredTestContext context) => $"{Counter++} {context.GetDisplayName().Replace("(", " (")}";
}
You must be logged in to vote
0 replies
Comment options

image even better using unicode Subscript. ```cs private string SubScript(uint number) => string.Join("", number.ToString().Select(x => (char)('0' + (x - '0')))); ```
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /