-
Notifications
You must be signed in to change notification settings - Fork 269
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
DataTestMethodAttribute doesn't have a constructor to set display name #2121
Comments
Hi @HannoZ, Thank you for the report. This indeeds looks like the feature missed some cases, we will work on it (except if you are willing to take care of it). What's the issue you are facing with building the repository? |
I would be glad to fix it myself, if I can manage to build the solution. There's a lot of advanced stuff in there so it's not very easy to troubleshoot. First I was having some issues with the .NET 9 alpha SDK, it seemed to be installed by running Build.cmd but it wasn't. So (after some searching) I found the installer on https://github.com/dotnet/installer. That helped to solve a lot of build errors, but there is one left in project FxExtensibility: "The analyzer assembly 'C:\Program Files\dotnet\sdk\9.0.100-alpha.1.24067.14\Sdks\Microsoft.NET.Sdk\codestyle\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll' references version '4.10.0.0' of the compiler, which is newer than the currently running version '4.8.0.0'." |
Thanks! I'll try to improve the build doc page.
Interesting, I don't have this even on clean build (git clean -dfx)
Have you run this script https://github.com/microsoft/testfx/blob/main/eng/Install-WindowsSDK.ps1? |
After running this script, all errors are gone! |
…ructor to set display name
Moved to 3.2.0 |
Hi @Evangelink Today I tested the new 3.2.0 package. The new constructor with displayname overload is there now, but unfortunately the display name seems to be ignored when the test is actually displayed..
|
Damn, sorry I should have looked at adding some integration test. I will create a different issue. Thanks for the report! |
Summary
The TestMethodAttribute has a constructor that allows you to set the DisplayName property. DataTestMethodAttribute inherits from this class, but doesn't have the constructor to provide a display name, so it's impossible to provide an alternative display name for
Background and Motivation
Providing a display name for unit tests is a nice way to have a more descriptive display for your tests. However it is now not possible to do this for DataTestMethod unit tests because the required constructor is not present.
DataRowAttribute does have the ability to set the DisplayName which is nice, but it would be great to also be able to set it for the test itself.
Proposed Feature
I guess it's just a matter of adding
public DataTestMethodAttribute(string? displayName) : base(displayName) { }
(I'm still trying to build the repository without success so I cannot verify this myself yet)
The text was updated successfully, but these errors were encountered: