visualstudio.xunit icon indicating copy to clipboard operation
visualstudio.xunit copied to clipboard

Can't navigate to test case through Visual Studio's Test Explorer if test is inherited from another project

Open bjornhellander opened this issue 3 years ago • 3 comments

Hi!

I am having issues navigating to test cases through the Test Explorer in this repository: https://github.com/DotNetAnalyzers/StyleCopAnalyzers

It has a test project per c# language version and inherits test cases from projects for earlier language versions into projects for later versions. If I double click in the Test Explorer on a test case in a project where it is inherited, nothing happens. Doing the same in the project where it is actually implemented works though.

Example: Test case TestFailureIssue780Async is implemented in project StyleCop.Analyzers.Test. If I have test cases grouped by Project+Namespace+Class and filter on the name in Test Explorer, I get a hit in all 5 test projects, as expected. However, trying to navigate to the test only works through the StyleCop.Analyzers.Test project, not any of the others.

This is annoying if I am running tests through one of the later test projects and need to check one of the older/inherited test cases. Not sure if this is in your hands at all, or if it's up to Visual Studio, but I am starting here.

xunit.runner.visualstudio version: 2.4.1 (have also tried to upgrade to 2.4.5, but that did not change this behaviour) Visual Studio version: 17.2.6

bjornhellander avatar Jul 16 '22 11:07 bjornhellander

I don't know that we have any control over this, but if we do, it belongs to the VSTest adapter, so I'm moving this issue there.

bradwilson avatar Jul 25 '22 02:07 bradwilson

As far as I know, we're using DiaSession correctly, or so the comment would imply, by using DeclaringType to determine where the assembly file is supposed to be. Someone will have to dig in with a debugger to understand if everything is working as expected, since you can't realistically simulate the behavior of Visual Studio without fully understanding it first.

bradwilson avatar Jul 25 '22 23:07 bradwilson

I tried the same with both MSTest and NUnit just now and got the same behaviour, so it feels unlikely that this is "on you". I reported it as Visual Studio feedback to see what they say: https://developercommunity.visualstudio.com/t/Unable-to-navigate-to-a-unit-test-inheri/10106372

bjornhellander avatar Jul 28 '22 10:07 bjornhellander

Closing as external. Thanks!

bradwilson avatar May 21 '23 21:05 bradwilson