Nunit 3.2.1 Tests not discovered on Visual Studio Test explorer - nunit

This is my configuration:
Visual Studio Enterprise 2015
NUnit 3.2.1
NUnit3 Test Adapter 3.0.10 (Installed as Extensions and Updates as well as through nuget package manager in project)
Target Framework is set to 4.5
Build succeeds fine but test discovery shows an error and 0 tests are discovered.
Error log:
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\projects\~
The NUnit 3.0 driver does not support the portable version of NUnit.
Use a platform specific runner.
NUnit Adapter 3.0.10.0: Test discovery complete.
Discover test finished: 0 found

When running the NUnit 3 Adapter (correct name) version 3.0.10, you are using NUnit 3.0.1 to run your tests. If the tests use the 3.2.1 framework, then there is some chance of an incompatibility. NUnit runners are always backward compatible. For example, you could use NUnit 3.2 to run NUnit 3.0 tests, but the reverse is not true.
The message you are seeing is actually misleading and was changed in the code recently. It assumes you are runing a portable test when a serialization exception occurs.

Related

.NET 6 Integration tests in Visual Test give error - The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found

I have migrated an integration test project from .Net Framework 4.8 to .NET6. The tests are running fine in local development machine. But when the same code is run using visual studio test task in Azure Devops release pipeline it is giving me the following error
HTTP Error 500.31 - ANCM Failed to Find Native Dependencies.
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Based on some of the suggestions for similar issue, I installed .Net 6 core runtime using use .net core task, and also gave console options as below to force the runtime version, but the error doesn't go away. The project is configured to run on Any CPU.
console options: /Platform:x64 /Framework:.NetCoreApp,Version=v6.0 /logger:trx;LogFileName=netcore-results.trx

2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1

I am trying to run my automation pipeline on Private hosted agent and getting error as Test Run Failed.
Error: The process 'C:\agent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1
Vstest failed with error. Check logs for failures. There might be failed tests.
Error: The process 'C:\agent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1 Vstest failed with error. Check logs for failures. There might be failed tests.
Based on the error message, the reason for this issue should be that the VSTest task supported .Net Framework 4.6.2 from version 2.170.1.
You need to check the .NET framework version installed on the build agent machine. If the .NET framework version installed on the machine is 4.6.1 or less than that then can you please try upgrading the .Net framework version to 4.6.2.
Here is a doc about the requirement about the Visual Studio test task:
If you're using a Windows self-hosted agent, be sure that your machine
has this prerequisite installed:
.NET Framework 4.6.2 or a later version
In addition, you can try to use the Visual Studio test task version 1.

Unsupported framework error NUnit and MonoDevelop

I have latest versions of MonoDevelop(5.10) and NUnit(3.6.1 installed from oficiall NuGet Gallery) and every time I'm trying to run tests I'm getting error
UnsupportedFrameworkException: Skipped loading assembly ... because it references an unsupported version of the nunit.framework 3.6.1.0
What can I do about it ?
You are apparently trying to run the tests from inside of MonoDevelop, which only supports NUnit through 2.4.8.
You need to install and run the nunit console runner. Use the NUnit.ConsoleRunner nuget package and run nunit3-console, which is contained in the package.

How can I run EntityFramework 7 tests?

I followed the steps here and have EntityFramework 7 building in VS2015.
Under RunTests the instructions above note the following:
Our tests are written using xUnit.net 2.0, and can be run using your
favorite runner. We recommend either the built-in Visual Studio test
runner or TestDriven.Net.
In VS2015, executing Test > Run > All Tests results in:
------ Discover test started ------
========== Discover test finished: 0 found (0:00:00.0990702) ==========
Taking a look at Running xUnit.net tests in Visual Studio reveals that you need to:
Search for (and install) a package named xunit.runner.visualstudio
However doing so results in a failed install, for either the current stable or prerelease package;
Resolving conflicts for DNXCore,Version=v5.0...
Unable to find a version of package 'System.Dynamic.Runtime' that is compatible with version constraint '[4.0.0, )'.
Unable to find a version of package 'System.Text.RegularExpressions' that is compatible with version constraint '[4.0.10, )'.
Unable to find a version of package 'System.ComponentModel' that is compatible with version constraint '[4.0.0, )'.
Unable to find a version of package 'System.IO.FileSystem' that is compatible with version constraint '[4.0.0, )'.
Unable to find a version of package 'System.Collections.Concurrent' that is compatible with version constraint '[4.0.0, )'.
========== Finished ==========
NotFound https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.framework.primitives/index.json 1078ms
How can I run the tests without a TestDriven.Net license?

AutoFixture.Xunit with Xunit.net 2.0 beta

I've already moved to the xunit.net 2.0 beta version, but need some feature from AutoFixture, which still depends on the current 1.9.2 stable release (CompositeDataAttribute). As far as I see AutoFixture.Xunit hasn't been upgraded yet (when?)
When I just try to install AutoFixture.Xunit with nuget it complains of the conflict with it's dependency on xunit 1.9.2 and if I ignore dependencies it compiles but tests are not being run (at least by the VS2013 and Resharper runners)
Any suggestions? thanks
Support for xUnit.net 2 was added to AutoFixture on April 8 2015. It was added as a new NuGet package, in order to make it optional if and when to migrate to xUnit.net 2. Thus, there are two Glue Library packages for AutoFixture and xUnit.net:
AutoFixture.Xunit for use with xUnit.net 1.x
AutoFixture.Xunit2 for use with xUnit.net 2.x