question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow use of FullName as the DisplayName for Converted Tests

See original GitHub issue

When reporting a bug, please provide the following information to speed up triage:

  • NUnit and NUnit3TestAdapter versions
  • Visual Studio edition and full version number (see Help About)
  • A short repro, preferably attached or pointing to a git repo or gist
  • What .net platform and version is being targeted
  • If TFS/VSTS issue, what version, hosted, on-premises, and what build task you see this in

Referencing this issue: https://github.com/nunit/nunit/issues/3015

We would like to include the TestFixture parameters value(s) in the TestName that gets created by the Test Adapter. Currently the only way to change the TestName is by using the

DefaultTestNamePattern

As noted in the referenced issue, there is not a way currently to specific the inclusion of the TestFixture parameters (when they exist). The workaround suggested was to allow for the usage of FullName as an option in the Nunit Test Adapter.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
OsirisTerjecommented, May 23, 2020

Thanks @CharliePoole and @svengeance for bringing this one up again.

FQN: The FQN issue is still open, and we’re discussing with the MS PG how to go about these things. It is pretty clear now that the FQN (which @svengeance is referring to above) is not working, and it has to change.

About this issue in particular: What you see in the Test Explorer is a mixture of two properties, FullyQualifiedName (FQN) and DisplayName.
The properties @svengeance points to above affects only the FQN from NUnit. Given a repro like this: image It will display the following: image and this is what NUnit sends to the adapter: image

Now, looking at what is being displayed for the different parts (putting the adapter into freak mode): image As can be seen from this, the TestMethod in itself is display by the DisplayName property, which comes from the NUnit Name property, but all the overlying nodes are picked from the FQN, which each part, separated by the dots, are one level in the tree. If we now implement the DisplayName to be equal to the FQN, it should bring along the format wanted:

image So not quite there. Notice that the lower test results box display the method with its full name, but the tree display still rips out everything ahead of the last dot. So, if we replace the dots to some other separator, like ‘:’ (IIRC it is used in some language…):

image

This could also be resolved in NUnit itself, but the replacing of the dots are rather VS specific. I am not sure if the Template Based Test Naming can be set up to provide the FQN here, @CharliePoole ?

If it is set in NUnit, it would apply to individual tests, but if set in the adapter, it would apply to all.

A short disclaimer here: The Real Time Test Discovery would still report the first name. It is first after execution that these names will come up. If RTD is turned off, then NUNit Test Discovery would kick in, and it would be displayed correctly.

0reactions
peponecommented, Feb 1, 2021

@OsirisTerje how do I enable this feature, running tests with dotnet test but the class parameters are not included

I using

   <PackageReference Include="NUnit" Version="3.12.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>

do I need to add anything to runsettings?

Read more comments on GitHub >

github_iconTop Results From Across the Web

DisplayNameFor() From List<Object> in Model
I believe this is pretty simple, I just can't seem to find the right way to show the display name for an item...
Read more >
c# - Change name of NUnit test
So far I can see, that FullName field of TestDetail has private setter. Is any other ways or approaches change display name for...
Read more >
Tips and Tricks | NUnit Docs
Using DisplayName you can change between Name , FullName or FullNameSep . The last one will then use the FullNameSeparator,which defaults to '...
Read more >
MAC Outlook can't change display name imap in new version
My main concern is Account full name (sender's name) cannot be edited in new outlook. But today I remark that this full name...
Read more >
Converting full name to user id for use in reporter field
Manually, it works, but with the automation, it fails, even though the name matches the users display name.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found