No xunit tests discovered in netcoreapp1.0 in VS
Tests are discovered and run
No tests are discovered
VS2017 RTM
I'm seeing a similar issue. No xunit tests are discovered in Visual Studio 2017 RTM.
In my case:
Do you see something similar? If not, I'll open a separate isuse.
@JamesNK Able to repro the issue, I can see [xUnit.net 00:00:01.3004793] Skipping: Newtonsoft.Json.Tests (could not find dependent assembly 'Newtonsoft.Json, Version=10.0.0') in VS test output panel.
Looks like issue with Newtonsoft.Json.Tests.deps.json, the right version of Newtonsoft.Json not getting added because the csproj file name(Newtonsoft.Json.Roslyn.csproj) and assembly name(Newtonsoft.Json) are not same.
Additional data point, After adding <PackageReference Include="Newtonsoft.Json" Version="10.0.1-beta1" /> for netcoreapp1.0, Tests are discovered.
@qmfrederik can you please provide project or csproj file?
@smadala Well, in my case the assembly name and project file name are different as well because I have VS2015 and VS2017 projects side-by-side. Is that the root case? In that case, I'm probably seeing the same issue.
It can be different issue, In case of Newtonsoft.Json, Test platform depends on version 9.1.0, because of that 10.0.0 not getting loaded which we can see in VS test output panel, In your case the log message is different and dotnet test -f <framework> works but not dotnet test. Please provide csproj/project I can investigate more.
Additional data point, After adding
for netcoreapp1.0, Tests are discovered.
Are you sure it's referencing the project output and not downloading from https://www.nuget.org/packages/Newtonsoft.Json/10.0.1-beta1?
@JamesNK Found root cause: https://github.com/NuGet/Home/issues/4586, it is fixed in VS 2017 RTM, I have verified it, all tests are running for netcoreapp1.0.
Are you sure it's referencing the project output and not downloading from https://www.nuget.org/packages/Newtonsoft.Json/10.0.1-beta1?
Yes, it was downloaded from nuget.org, Mentioned it to indicate issue with ProjectReference.
I'm using the RTM and it doesn't work
@smadala Here's an example of a .csproj and the test.props file we use:
tests.zip
I've actually seen VS discover the tests briefly, but now once again, they are not discovered, I get the "The given key was not present in the dictionary." error in the Test output window and dotnet test doesn't discover any tests.
@JamesNK can you please provide VS build number?
I'm using the RTM and it doesn't work
I retried and it is now working. My issue is fixed. Feel free to close when everything else is resolved.
@qmfrederik I couldn't find any issue with package reference in test project. can you please share log files(dotnet test --diag:log.txt) log.txt and log.host.
@smadala Here are the logs, I've ran dotnet test with and without the -f netcoreapp1.1 argument.
@JamesNK Do you know what fixed the issue for you?
@smadala Quick update: my .csproj files did not specify the RuntimeIdentifier property, only RuntimeIdentifiers, because I target multiple runtimes.
I've added a RuntimeIdentifier property and it _looks_ like the tests are being discovered in Visual Studio. dotnet test still does not, though.
@JamesNK Do you know what fixed the issue for you?
Nope!
Look at this
http://www.michael-whelan.net/the-state-of-dotnet-core-testing-today/
x-unit runs in VS 2015 for .Net core app 1.0
Install-Package xunit -Pre
Install-Package dotnet-test-xunit -Pre
@qmfrederik can you please share sample project which repro the issue?
Closing this because no repro.