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

TestCaseData.SetName issue #2333

Closed
dgm90 opened this issue Jul 28, 2017 · 5 comments
Closed

TestCaseData.SetName issue #2333

dgm90 opened this issue Jul 28, 2017 · 5 comments

Comments

@dgm90
Copy link

dgm90 commented Jul 28, 2017

When I use the SetName method to name my test and the name contains a dot, the VS Test Explorer doesn't display the test properly.
image

All the tests on the screen above are used in the same methods, but in the Test Explorer they are shown like different classes. All tests that don't have a dot in their name are combined in "CreateOrdersTests" - 5 items. But the "CreateSingleOrderChargeRate1.5 is put in the separate class "CreateSingleOrderChargeRate1".

If I substitute the dot with a comma, the issue is resolved. Check the screen.
image

Thanks.

@CharliePoole
Copy link
Contributor

NUnit test names look like the full name of a method - plus optional arg list - by default, but we allow the user to change the name of the method part. NUnit actually has no expectations at all for the format of a name and does not even use the name to find tests unless you ask it to via a filter. IOW, an NUnit test name is an arbitrary string that does not even have to be unique.

Visual Studio, OTOH, assumes that tests are named as the full name of a test method and requires them to be unique. This is a mismatch that can never be completely overcome. For that reason, we can only suggest that users do not use names containing a dot, since it confuses visual studio.

My inclination is to close this as not a bug. An alternative is to mark it as an adapter bug. It's possible for the adapter to modify the name to meet vs requirements. I definitely do not think we should modify it generally, just for the sake of a single runner.

@OsirisTerje If you would want to accept this as an issue for the adapter, please move it. Otherwise, let's close it.

@dgm90
Copy link
Author

dgm90 commented Aug 2, 2017

Hello Charlie,

Thanks for your detailed response.

@OmicronPersei
Copy link
Contributor

Closing this for the reasons @CharliePoole gives above.

@xhafan
Copy link

xhafan commented Apr 25, 2019

This actually helped me: do not use names containing a dot

@ksokolowski7
Copy link

Solution for this case is to replace dot with \u2024. So just before naming the test use .Replace(".", "\u2024")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants