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
Visual Studio 2017 RC does not detect nunit tests #305
Comments
@CharliePoole I get no output from the tests output window. |
That would indicate either that it's not installed or that VS isn't calling it for some reason. |
I was under the impression that the adapter doesn't currently work with the new csproj format? There's a workaround on the issue below however: |
Right... but I was under the impression that it doesn't always use that format, depending on how you create the project. That's what I meant in suggesting that @claunia recreate it. Am I wrong? Do all new VS2017 projects use the new format? |
I'm hitting the same issues here with a project that was originally a .net core Project.
I downloaded the NUnit.Framework-3.6.0.zip and extracted the contents to the output directory and got a slightly different error:
This to me suggests that required assemblies needed to run the tests aren't loading or aren't being loaded from the correct place. |
The project is configured at a .Net Standard 1.6 Library. So I doubt Visual Studio 2017 has any reason to include required assemblies into the output build folder |
Any update on the issue? When can we expect it to be fixed? |
I have similar issue in release, but workaround is working Visual Studio Config: VS 2017 + NUnit Test Adapter 3.7.0 I target test project to net45 and add this: |
I'm sure no one is as daft as I am, but I was having this issue and the reason was that my test project had a reference to Nunit2 (I was so sure that upgraded to 3 on all projects that it took me a long while to check this), and therefore the Nunit3 adapter wasn't picking up any tests. I removed the reference and installed nunit3, that did it for me. Edit: Visual Studio Professional 2017 15.0.0+26228.10 | .NET 4.6 |
@ManyouRisms The issue is with .NET Core test projects and not those purely targeting .NET 4.x. |
Thanks to @AlexeiScherbakov 's great workaround. Some explanation (my understanding though) for those who encounter this: The new .NET Core .csproj by default uses the new portable PDB as . However, many 3rd party tools do not support this new format yet. So they try to parse it as the old PDB but crashes. E.g. I also got error when using DotCover to compute coverage. So the current workaround is to set it to the same as old .csproj, which is However, VS Code only supports portable PDB. |
@AlexeiScherbakov @qrli Must I use the DebugType workaround in the test project ( |
@grokky1 Only the test assembly needs |
@grokky1 AFAIK, you need the debug type workaround if you are using the new CSPROJ format with the Full .NET Framework. If you are targeting .NET Core or .NET Standard, you need to use the 3.8.0-alpha1 release of the adapter, see https://github.com/nunit/nunit3-vs-adapter/releases/tag/3.8-alpha1 If you are using full .NET Framework with the original CSPROJ format, you shouldn't need to do anything special. You will need to give us more info to help you pinpoint your exact issues. |
@rprouse My projects are .NET Core 1.1.2, and I'm using VS2017, csproj, and the new adapter. Tests are discovered only when I use the workaround. |
@grokky1 thanks for the info. |
using latest 3.8-alpha1 release nunit works with .netcore test project and vs2017 but with .netstandard it doesn't work.
can anyone explain what does that mean?
It looks like minor bug that can be fixed. |
net core & net standard is not same.
TargetFramework for .net core is netcoreapp1.1 not netstanard1.6
20 Июн 2017 г. 12:46 пользователь "Oleksandr-Tokmakov" <
notifications@github.com> написал:
using latest 3.8-alpha1 release nunit works with .netcore test project and
vs2017 but with .netstandard it doesn't work.
https://github.com/nunit/nunit3-vs-adapter/releases/tag/3.8-alpha1
Your test assemblies must also be .NET Core, not .NET Standard, *I don't
know why*.
can anyone explain what does that mean?
With .net standard test project when I open solution in Tests output I see:
…------ Discover test started ------
NUnit Adapter 3.8.0.0: Test discovery starting
Dependent Assembly nunit.framework of ~\Tests\bin\Debug\
netstandard1.6\Domain.Tests.dll not found. Can be ignored if not a NUnit
project.
NUnit Adapter 3.8.0.0: Test discovery complete
========== Discover test finished: 0 found (0:00:00.5544894) ==========
It looks like minor bug that can be fixed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#305 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIQ7O30Lyt4rCTMyRNckW26F7kca-TbBks5sF5TegaJpZM4MKjgz>
.
|
I'll close this item now. @AlexeiScherbakov See posts linked above. .Net standard can be tested, but test project must target a platform. |
@OsirisTerje , I think that is not same. My workaround is for people, who installed for Vsix test adapter. And it worked without 'Microsoft.Net.Test.Sdk' package. In your link 'Trying to use a Vsix test adapter to test .net core. This will not work'. This is issue for VSIX Test Adapter, not for Nuget package, so I think it must stay open before VSIX test adapter can do same thing, or may be before VSIX test adapter is marked as deprecated methods of running tests in VS2017 My test project:
|
This is unclear to me. Further, the code for the vsix and the adapter is the same, there is no difference, it is just different packaging, and the nuget adapter works with portable pdb format. I have just tested using your workaround too, and it doesnt seem to have any effect. I might be missing something here. Given new or old csproj format with .net framework, it works, both with the vsix and with the nuget. But, with the .net core 2, it only works with the nuget adapter. I have asked the MS product group directly if they can help shed some light on this. |
Tests from this test project
still not visible on TestExplorer in VS 15.3.5, with or without NUnit 3.8.0 VSIX enabled. Testdriven.net is the only way to run tests from VS I found. |
@sm-g Can you please upload or point to a repro project? |
@sm-g Just also noticed that you're running in x64. Have you switched (from Main VS menu) the Test/Test Settings/Default Architecture to x64 ? |
this was the reason, thanks |
Glad you fixed it 👍 |
Doesn't work for netcoreapp2.0 <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="NUnit" Version="3.9.0" />
<!-- Extension vsix installed for N3Unit Adapter -->
</ItemGroup>
</Project> Requires that you replace with. <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFramework>net471</TargetFramework> Is this a known issue or a bug? |
.net core doesnt work with vsix, you must use the nuget adapter |
@Latency as @OsirisTerje says, the VSIX version of the test adapter does not work for .NET Core. This is not a limitation of NUnit, but of Visual Studio. Install the NuGet and it will work for you. Sorry, nothing we can do. |
@claunia commented on Thu Feb 23 2017
Hi,
Visual Studio 2017 RC does not detect nunit tests. Package references NUnit 3.6.0, VS has NUnit 3 Test Adapter 3.7.0.0 installed, and project targets both .NET 4.0 and .NET Core RC4.
Running manually nunit from console or GUI works (targetting the .NET 4.0), but gets no debug backtrace (showing simply NullReferenceException on the test but not the backtrace of where it really happened).
@JustinRChou commented on Thu Feb 23 2017
If I am not wrong, the test runner for 2017 isn't ready yet.
#297
@CharliePoole commented on Thu Feb 23 2017
The adapter supports VS 2017 but not .NET Core as yet. See the issue referenced by @JustinRChou
@claunia commented on Thu Feb 23 2017
@CharliePoole read again, my project targets BOTH .NET Framework 4.0 not .NET Core. The tests are not detected even if I remove the multitargetting and leave .NET Framework 4.0 alone.
@JustinRChou commented on Thu Feb 23 2017
@claunia
It's an issue with Visual Studio 2017 itself.
The test explorer in the IDE is having issues since the NUnit test adapter hsan't been updated for that IDE.
@CharliePoole commented on Thu Feb 23 2017
@JustinRChou The NUnit 3 Test Adapter is developed and tested using VS2017. In fact, it's not possible to build it with VS2015 or lower any longer.
@claunia Am I correct to assume we are talking about the NUnit 3 Visual Studio Adapter and not the NUnit dotnet runner? I'd like to move the problem to the correct repository.
@claunia commented on Thu Feb 23 2017
@CharliePoole I'm pretty much old-fashioned, I'm not using dotnet but VS only.
This is exactly what I did:
1.- Remove old csproj
2.- Create new csproj specifying .NET Core Library on VS2017
3.- Changed netcoreapp1.0 to net40;netcoreapp1.0
4.- Added NuGet reference to NUnit 3.6.0 inside VS2017 menu
5.- Added NUnit Adapter 3.7.0 in VS2017 Extensions menu
6.- Tried changed net40;netcoreapp1.0 to net40 as suggested in #297 that .NET Core was not supported
@CharliePoole commented on Thu Feb 23 2017
@claunia It's possible that starting out with a .NET core project has led to the problem. Things you may try:
I'm moving this to the adapter repository.
The text was updated successfully, but these errors were encountered: