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

Fail to run tests in VS2017 15.6 #476

Closed
twenzel opened this issue Mar 7, 2018 · 35 comments
Closed

Fail to run tests in VS2017 15.6 #476

twenzel opened this issue Mar 7, 2018 · 35 comments

Comments

@twenzel
Copy link

twenzel commented Mar 7, 2018

With NUnit 3.9 and the TestAdapter v3.9 the execution of tests within VisualStudio does not work anymore.

[07.03.2018 08:22:48 Informational] ------ Load Playlist started ------
[07.03.2018 08:22:48 Informational] ========== Load Playlist finished (0:00:00,0320021) ==========
[07.03.2018 08:26:05 Informational] ------ Run test started ------
[07.03.2018 08:26:07 Informational] NUnit Adapter 3.9.0.0: Test execution started
[07.03.2018 08:26:07 Informational] Running all tests in C:\Data\GIT\IdentityProvider\tests\CHG.IdentityServer.Tests\bin\Debug\net461\win7-x86\CHG.IdentityServer.Tests.dll
[07.03.2018 08:26:08 Warning] Exception System.InvalidOperationException, Exception thrown executing tests in C:\Data\GIT\IdentityProvider\tests\CHG.IdentityServer.Tests\bin\Debug\net461\win7-x86\CHG.IdentityServer.Tests.dll
[07.03.2018 08:26:08 Warning] Operation is not valid due to the current state of the object.
[07.03.2018 08:26:08 Warning]    at Mono.Cecil.ModuleDefinition.ProcessDebugHeader()
   at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader)
   at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)
   at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at NUnit.VisualStudio.TestAdapter.NavigationDataProvider.CacheNewTypes(String assemblyPath, IDictionary`2 types) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NavigationDataProvider.cs:line 103
   at NUnit.VisualStudio.TestAdapter.NavigationDataProvider.GetNavigationData(String className, String methodName) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NavigationDataProvider.cs:line 48
   at NUnit.VisualStudio.TestAdapter.TestConverter.MakeTestCaseFromXmlNode(XmlNode testNode) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\TestConverter.cs:line 144
   at NUnit.VisualStudio.TestAdapter.TestConverter.ConvertTestCase(XmlNode testNode) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\TestConverter.cs:line 79
   at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, TestFilter filter) in C:\Users\Terje\Source\Repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 249
[07.03.2018 08:26:08 Informational] NUnit Adapter 3.9.0.0: Test execution complete
[07.03.2018 08:26:08 Warning] No test is available in C:\Data\GIT\IdentityProvider\tests\CHG.IdentityServer.Tests\bin\Debug\net461\win7-x86\CHG.IdentityServer.Tests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[07.03.2018 08:26:08 Informational] ========== Run test finished: 0 run (0:00:03,1841635) ==========

@jnm2
Copy link
Contributor

jnm2 commented Mar 7, 2018

This is #296, fixed in #454. We'll be releasing with the fix very soon. If you want to help us be sure we've covered your scenario (which we appreciate!), you can merge this with your nuget.config and try version 3.10.0-dev-00750 or newer:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="NUnit prerelease" value="https://www.myget.org/F/nunit/api/v3/index.json" />
    </packageSources>
</configuration>

@twenzel
Copy link
Author

twenzel commented Mar 7, 2018

I can confirm that using version 3.10.0-dev-00820 the issue is gone and my tests are running again.

@twenzel twenzel closed this as completed Mar 7, 2018
@jnm2
Copy link
Contributor

jnm2 commented Mar 7, 2018

Great, thank you!

@rprouse
Copy link
Member

rprouse commented Mar 7, 2018

Thanks for getting back to us @twenzel. The release version of the adapter should be out any day now.

@andrewkhomski
Copy link

Hi

I am still facing the same issue:
Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

I am using latest VS 2017 and latest 3.x Nunit and Nunit Adapters...

Is this a wrong topic I am updating?

Thank you
Andrew

@OsirisTerje
Copy link
Member

Which version of the adapter and NUnit itself are you using?
What VS version do you see this in?
What kind of test project (.net FW, or .net core ) do you see this in?
Do you have any repro you could share?

@andrewkhomski
Copy link

Hi Osiris

Thank you for your reply. Truthfully i am almost at the "give up" point... :(

Here the answers for each question:

Which version of the adapter and NUnit itself are you using?

  • VS Nuget Package for Nunit: v.3.10.1 - VS Nuget Package for Nunit3TestAdapter: v.3.10.0
    What VS version do you see this in?
  • VS 2017 Enterprise
    What kind of test project (.net FW, or .net core ) do you see this in?
  • .net FW
    Do you have any repro you could share?
  • Not sure what it means, but if needed i can zip and send solution

Note - i am very new to this.
I was learning and making a good progress on my own (from internet). at my work i came across these Tests that were written in VS 2013 and Nunit 2.x. So first they were not showing in the Test Explorer. Now i made them show but have this message and basically not running anymore.

Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

And now my previously written solution i was learning with and developed on my own - also not working with the similar issue.

Thank you very much!
Andrew

@OsirisTerje
Copy link
Member

Yes, Please upload the solution, and we can have a look No need to give up :-)

@andrewkhomski
Copy link

Osiris

Here it is. This is the Solution i was learning by myself and it was working and running fine.

SeleniumFirstA.zip
SeleniumFirstA (2).zip

Thank you!
Andrew

@andrewkhomski
Copy link

Osiris

Here is a list of few zip files as i could not upload them as 1 zip file - too large.

This is the Solution that cam from VS 2013 and Nunit 2.x..

Please let me know what else needed.

Allergy_Console.zip
obj.zip
packages.zip
SeleniumTest.zip

Thank you
Andrew

@andrewkhomski
Copy link

andrewkhomski commented Jun 4, 2018 via email

@OsirisTerje
Copy link
Member

I'll look at it as is, no problem.

@andrewkhomski
Copy link

andrewkhomski commented Jun 4, 2018 via email

@rprouse
Copy link
Member

rprouse commented Jun 5, 2018

@andrewkhomski you say that your tests are using NUnit 2.x, but you are using the NUnit 3 adapter. If so, that doesn't work, you need to use the NunitTestAdapter, not the Nunit3TestAdapter.

@andrewkhomski
Copy link

Hi Prouse

Thank you for your response.

Actually what i reported, that the Solution "SeleniumFirstA.zip" was developed by myself (just a learning exercises) on VS 2017 with Nunit v.3.10.1. And it used to work untill i started reconfiguring and making updates to the next Solution: "SeleniumTest.zip".
This "SeleniumTest.zip" solution was developed on the VS 2013 with Nunit 2.x. I have loaded into my machine with VS 2017 and Nunit 3.10.1 and it won't run due to the errors i mentioned.

[6/4/2018 2:43:34 PM Informational] ------ Discover test started ------
[6/4/2018 2:43:35 PM Informational] NUnit Adapter 3.10.0.21: Test discovery starting
[6/4/2018 2:43:36 PM Informational] Assembly contains no NUnit 3.0 tests: C:\ihealautomatedTests\SeleniumTest\bin\x64\Debug\SeleniumTest.dll
[6/4/2018 2:43:36 PM Informational] NUnit Adapter 3.10.0.21: Test discovery complete
[6/4/2018 2:43:36 PM Informational] ========== Discover test finished: 0 found (0:00:01.4975381) ==========
[6/4/2018 2:44:01 PM Informational] ------ Run test started ------
[6/4/2018 2:44:01 PM Informational] NUnit Adapter 3.10.0.21: Test execution started
[6/4/2018 2:44:01 PM Informational] Running all tests in C:\ihealautomatedTests\SeleniumTest\bin\x64\Debug\SeleniumTest.dll
[6/4/2018 2:44:02 PM Informational] NUnit couldn't find any tests in C:\ihealautomatedTests\SeleniumTest\bin\x64\Debug\SeleniumTest.dll
[6/4/2018 2:44:02 PM Informational] NUnit Adapter 3.10.0.21: Test execution complete
[6/4/2018 2:44:02 PM Warning] No test is available in C:\ihealautomatedTests\SeleniumTest\bin\x64\Debug\SeleniumTest.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[6/4/2018 2:44:02 PM Informational] ========== Run test finished: 0 run (0:00:01.1223973) ==========

Appreciate your help!
Andrew

@andrewkhomski
Copy link

Good Day

Sorry to bother you Rob and Terje. I also uploaded the same files into Github if needed.

At this point i understand you are busy with other problems.

For us here is the issue with this configuration (my opinion) and this is why Tests won't run probably.

Not asking for solution if needed, but do you know of any workarounds so we can progress with developing new or updating existing Tests.

Thank you very much!
Andrew

@OsirisTerje
Copy link
Member

Sorry it takes some time. Is the github upload complete? so I can just clone and run ? That would make it simpler to check it.
What is the github repo address?

@andrewkhomski
Copy link

andrewkhomski commented Jun 7, 2018 via email

@OsirisTerje
Copy link
Member

Thanks.

Sorry to be a bit picky, but could you upload it all unzipped ? Then it is also easier to make changes if needed, and easier to run it from the clone

@OsirisTerje
Copy link
Member

OsirisTerje commented Jun 7, 2018

Ran the first solution, and it worked as it should:
bilde

Make sure you have the test settings to run in x86 though.
(Note, I have no VSIX installed, using just the adapters specified in your solution)

@andrewkhomski
Copy link

andrewkhomski commented Jun 7, 2018 via email

@andrewkhomski
Copy link

andrewkhomski commented Jun 7, 2018 via email

@andrewkhomski
Copy link

andrewkhomski commented Jun 7, 2018 via email

@andrewkhomski
Copy link

Hi Terje

Did you try to run the 2nd solution (the "migrated" one)? Please let me know if you need anything else.

Thank you very much!
Andrew

@ilog2000
Copy link

ilog2000 commented Jun 12, 2018

Hello! The same happens to me.
[12.06.2018 15:16:08 Warning] No test is available in <...>.IntegrationTests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

VS 2017 v15.7.3

csproj file with versions

<Project Sdk="Microsoft.NET.Sdk">
  <Import Project="..\..\build\SrcCommon.props" />

  <ItemGroup Label="TestPackageReferences">
    <PackageReference Include="NUnit" Version="3.10.1" />
    <!-- Required by `dotnet test` to run correctly. -->
    <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
    <!-- Required by `dotnet test` to run correctly. -->
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
    <!-- Required by `dotnet test` to run correctly. -->
    <PackageReference Include="Microsoft.TestPlatform.TestHost" Version="15.3.0" />
  </ItemGroup>

  <ItemGroup Label="PackageReferences">
    <PackageReference Include="Moq" Version="4.7.145" />
  </ItemGroup>

  <ItemGroup Label="ProjectReferences">
    <ProjectReference Include="..\..\src\ProcessFeed\ProcessFeed.csproj" />
    <ProjectReference Include="..\Tests.Common\Tests.Common.csproj" />
  </ItemGroup>

  <ItemGroup Label="NUnitTestProjectMarker">
    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
  </ItemGroup>
</Project>

Integration tests use base class with SetUp attribute located in Tests.Common project (which references NUnit of the same version).

Target framework .NET 4.7.1, not Mono

@OsirisTerje
Copy link
Member

OsirisTerje commented Jun 12, 2018

@ilog2000
Can you please upload a repro project?
Make it as small as you can, it should compile "as is".

Please also read through and check http://hermit.no/how-to-resolve-cases-of-visual-studio-no-tests-appearing/

@OsirisTerje
Copy link
Member

@andrewkhomski Does the first solution work for you now? Is it only the 2nd solution that doesn't work?

@andrewkhomski
Copy link

Hi Terje

For the 1st solution (simple - the one i code):
I am getting this error even when i set to test setting = 86. I have uninstalled and installed back the Chrome webdriver and still the same issue. It used to work as fine as in your screen shot..

Message:
System.InvalidOperationException : session not created exception from tab crashed (Session info: chrome=66.0.3359.181) (Driver info: chromedriver=2.39.562718 (9a2698cba08cf5a471a29d30c8b3e12becabb0e9),platform=Windows NT 10.0.10586 x86_64) (SessionNotCreated) TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

Thank you!
Andrew

@ilog2000
Copy link

ilog2000 commented Jun 12, 2018

@OsirisTerje unfortunately not - this is a part of a company project under NDA. But I am close to revealing the root cause of this issue, and looks like this is not NUnit Adapter at all. Before leaving the office I found a version mismatch in Microsoft.Extensions.Primitives binding redirect in App.config. Will confirm tomorrow.

@ilog2000
Copy link

Confirmed, the real issue I had is assembly version mismatch. We use some legacy classic .NET libraries, and target .NET Core 1.1 in our projects. But Tests.Common contained App.config with the following binding redirects

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>

There was no build errors or warningns, but NUnit Adapter was unable to discover tests there. Having in mind this open issue #489 all becomes explainable. After setting redirect to 1.1.1.0 tests got discovered and everything works as expected.

@OsirisTerje thank you for paying attention.

@andrewkhomski
Copy link

Hi Terje

Is solution provided by ilog2000 will work for me as well? Or it is a different issue and you still looking into this.

Thank you
Andrew

@rubenVerschueren
Copy link

I had the same issue. for me it was resolved by adding some package references in the csproj file.

I found this thanks to the link posted by Terje (look at section 2.3) :
http://hermit.no/how-to-resolve-cases-of-visual-studio-no-tests-appearing/

@andrewkhomski
Copy link

andrewkhomski commented Jul 3, 2018 via email

@vatansoni89
Copy link

I m getting same issue, what is the fix???

@OsirisTerje
Copy link
Member

@vatansoni89

"I found this thanks to the link posted by Terje (look at section 2.3) :
http://hermit.no/how-to-resolve-cases-of-visual-studio-no-tests-appearing/ "

And if you don't find anything that matches, please upload a repro showing the issue you have.

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

8 participants