-
Notifications
You must be signed in to change notification settings - Fork 261
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
TestMethod displayName is being ignored if DataRowAttribute is specified #1635
Comments
Sorry for the delay in triaging this issue! Thank you for the detailed explanation and working repro case! I have tested with older versions of MSTest and can conclude this is not a regression so I will proceed and mark this issue as a feature request more than a bug. Because the code base was inherited it's hard to say what was part of the initial design. There is a I think that your initial expectation is coherent to me and this seems to be something we should improve. |
Hey @Evangelink, thanks for looking into this! I saw the
which is not great.. 2.) I have a test class attribute to overwrite to prefix a version to each test in a testclass, like:
and in the ApiVersionAttribute I'm updating the displayName. This works well for TestMethods without a DataRow, but won't update the name if the TestMethod has a DataRow. I was hoping that this problem would also be solved if the TestMethod Name would get picked up. Thanks a lot! |
Moved to milestone 3.2 |
I found a related issue and asked about it on StackOverflow. They suggested I ask on this ticket if you consider this as part of the bug, if not I'll open a new ticket. I'm using VS2022 17.6.5, .NET 7, MS Test SDK 17.7.0, MS Test Adapter and TestFramework 3.1.1.
Cheers, Mike |
DataRow is implemented using the ITestDataRow extension point, so this looks like a bug in the "new" view, where each data row is shown as a single test. The Imho the best solution here is to implement the same thing that was here before, where the display name is inherited and used together with the data, unless the user defines the name directly on the datarowattribute, in that case we overwrite the whole name. |
Thanks for the investigation @nowhnd. I double checked the code and I think you are right, the only proper way to fix would be to do a breaking change to allow passing extra args. I would suggest to move this to the v4 milestone. |
Describe the bug
When specifying a displayName in a TestMethod, it works as expected and the display name is picked up.
However, if a DataRowAttribute is used on a TestMethod, the displayName of the TestMethod is being ignored.
Versions:
Steps To Reproduce
Provided 2 tests, both with custom displayNames, one with a DataRowAttribute, and another one without:
Expected behavior
Expected behavior is that the custom display name is picked up for both tests, like:
Actual behavior
TestMethod2 does not pick up the custom name
The text was updated successfully, but these errors were encountered: