Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettify Test Method Display Name #644

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public TestMethod(string name, string fullClassName, string assemblyName, bool
Debug.Assert(!string.IsNullOrEmpty(fullClassName), "Full className cannot be empty");

this.Name = name;
this.DisplayName = this.GetFriendlyName(name);
this.FullClassName = fullClassName;
this.AssemblyName = assemblyName;
this.IsAsync = isAsync;
Expand All @@ -49,6 +50,11 @@ public TestMethod(string name, string fullClassName, string assemblyName, bool
/// </summary>
public string Name { get; private set; }

/// <summary>
/// Gets the display name of the test method
/// </summary>
public string DisplayName { get; private set; }
ahmedalejo marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Gets the full classname of the test method
/// </summary>
Expand Down Expand Up @@ -102,5 +108,7 @@ public string DeclaringClassFullName
/// Gets a value indicating whether specifies test method is async
/// </summary>
public bool IsAsync { get; private set; }

private string GetFriendlyName(string name) => name?.Replace('_', ' ')?.Trim();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal TestCase ToTestCase()
this.TestMethod.Name);

TestCase testCase = new TestCase(fullName, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName);
testCase.DisplayName = this.TestMethod.Name;
testCase.DisplayName = this.TestMethod.DisplayName;

testCase.SetPropertyValue(TestAdapter.Constants.TestClassNameProperty, this.TestMethod.FullClassName);

Expand Down