nunit-vs-adapter
nunit-vs-adapter copied to clipboard
No Source location for inner (nested) test fixture class
Hi,
if inner (nested) class is marked with TestFixture, then there is no information about source code:
public class OuterClass
{
[TestFixture]
public class InnerClass
{
The source information is not present at least for parametrized tests, I have not checked normal tests. The lack of source information can be seen in VS Test Explorar, but also when using vstest programmatically through VsTestConsoleWrapper.
Attaching Nested.zip - solution with:
- NestestClassTest project which contains tests cases for "normal" and "nested" class
- Microsoft.TestPlatform.TranslationLayer.E2ETest which provides program executable which uses VsTestConsoleWrapper and shows displays TestResults/TestCases returned
Reproduction steps:
- Unpack zip to a folder, for example C:\tmp\Nested
- Build solution
- Run tests using VS test explorer
- Notice for "NormalClass" tests there is Source link in details
- Notice for "InnerClass" tests there is "Source: no source available" text present. This means that for passed tests there is no information about location at all, as stack trace is also not available
- Run tests using VsTestConsoleWrapper
- Download vstest.console.runner (https://www.nuget.org/packages/Microsoft.TestPlatform/15.6.0-preview-20180109-01), unpack to a folder, for example C:\tmp\microsoft.testplatform.15.6.0-preview-20180109-01
- Run Microsoft.TestPlatform.TranslationLayer.E2ETest.exe with apropriate arguments, for example: "C:\tmp\Nested\Microsoft.TestPlatform.TranslationLayer.E2ETest\bin\Debug\net451\win7-x64\Microsoft.TestPlatform.TranslationLayer.E2ETest.exe" "--runner:C:\tmp\microsoft.testplatform.15.6.0-preview-20180109-01\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" "--testassembly:C:\tmp\Nested\NestedClassTest\bin\Debug\NestedClassTest.dll" "--testadapterpath:C:\tmp\Nested\packages\NUnitTestAdapter.2.1.1\tools\NUnit.VisualStudio.TestAdapter.dll"
- Notice that TestCase associated with results for "InnerClass" do not have source CodeFilePath and LineNumber

Here is the fix that was done to the current adapter: https://github.com/nunit/nunit3-vs-adapter/pull/285
That pull request was merged in a year ago. Why is this still a problem? We are still setting the issue resolved by #285 when upgrading to 3.9 from 2.6.4 in visual studio 2017. "No source available"
@OsirisTerje Should we move this to the nunit3 adapter repo?
From my (test adapter user) perspective, if I had problem with test adapter v2, I would search issues in test adapter v2 github project, not v3.
If problem also occurs in test adapter v3 (I think I also tested v3 and I think this problem did not happen for me - I'm not 100% sure) I would prefer to have a separate issue created in the v3 github project.
If it's a problem in the v2 adapter, then it belongs here. If other people have a problem on v3, we may need a separate issue.
The reason I asked is that we're doing our best to move people to v3 and the v3 adapter to focus our efforts there rather than publish a new v2 adapter.
Understood. My comment was meant to reflect my disagreement with that policy.