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

No Source location for inner (nested) test fixture class #164

Open
pkrukp opened this issue Jan 17, 2018 · 7 comments
Open

No Source location for inner (nested) test fixture class #164

pkrukp opened this issue Jan 17, 2018 · 7 comments

Comments

@pkrukp
Copy link

pkrukp commented Jan 17, 2018

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:

  1. Unpack zip to a folder, for example C:\tmp\Nested
  2. Build solution
  3. 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
  1. 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

nunit inner class

@jnm2
Copy link
Contributor

jnm2 commented Jan 18, 2018

Here is the fix that was done to the current adapter: nunit/nunit3-vs-adapter#285

@spencerb02
Copy link

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"

@jnm2
Copy link
Contributor

jnm2 commented Feb 7, 2018

@OsirisTerje Should we move this to the nunit3 adapter repo?

@pkrukp
Copy link
Author

pkrukp commented Feb 8, 2018

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.

@CharliePoole
Copy link
Contributor

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.

@jnm2
Copy link
Contributor

jnm2 commented Feb 8, 2018

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.

@CharliePoole
Copy link
Contributor

Understood. My comment was meant to reflect my disagreement with that policy.

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

No branches or pull requests

4 participants