Visual Studio For Mac Tests Not Running

  1. Visual Studio For Mac Os
  2. Visual Studio For Mac
  3. Visual Studio For Mac Tutorial
  4. Visual Studio For Mac Tests Not Running In Parallel
  5. Visual Studio For Mac

Extension for Visual Studio - NUnit 3 adapter for running tests in Visual Studio. Works with NUnit 3.x. For running NUnit 2 tests, use the NUnit 2 adapter.

Visual Studio for Mac. Unit Tests are not running. 'The second option allows Visual Studio to 'fallback' to the old behavior and search for test adapter. Visual Studio for Mac enables the creation of.NET Core solutions, providing the back-end services to your client solutions. Code, debug, and test these cloud services simultaneously with your client solutions for increased productivity. For example, if you're building a Visual Studio solution in Azure Pipelines, your build pipeline should include a Visual Studio Test task. After your build starts, this task automatically runs all the unit tests in your solution - on the same build machine.

The switch from the project.json format to the new csproj based format for .NET Core and .NET Standard projects also changed the API for test adapters. Because of this, NUnit’s dotnet-test-nunit adapter stopped working and we had to update our existing Visual Studio test adapter to support .NET Core. Last night I released the first alpha release of the test adapter to NuGet enabling testing of .NET Core and .NET Standard projects using Visual Studio 2017, Visual Studio Code, TFS Build, and, the dotnet test CLI command.

Creating a Test Project

The following instructions are for Visual Studio, but the principles apply to all development environments.

In the solution that you want to test, Add | New Project… and add a Visual C# | .NET Core | Class Library (.NET Core).

Visual

Visual Studio For Mac Os

I am testing a .NET Standard library, but I am using a .NET Core class library for testing. Testing requires a platform to test on, so your test assembly must target a specific platform. I selected .NET Core, but I could also target .NET 4.5 or even multi-target the test assembly. Be aware that multi-targeted test projects are barely supported by Visual Studio and your results may vary. Hopefully we will see improvements in the tooling soon.

Adding NuGet References

First, you will want to add a project reference to the project you are testing, then add NuGet references to the test framework NUnit 3.6.1, to the test runner NUnit3TestAdapter 3.8.0-alpha1 and to the test SDK Microsoft.NET.Test.Sdk 15.0.0. Add the references either using the Manage NuGet Packages… user interface, or by editing the project file.

  • Xamarin.UITest 2.2.6 Visual Studio for Mac v7.6.11 Stable. Whenever I run tests locally targeting an. In my visual studio for Mac 2017, I can not find the connection string to set in web.config, in a AS. I am trying to help someone clone a repo from TFS 2015 to a MacBook running Visual Studio for Mac an.
  • I am new to Xamarin and have managed to create tests on Xamarin Test Recorder and then use that in Xamarin.UITest to edit those and run tests from the IDE with a Genymotion emulator and even exporting these to the Test Cloud (trial).
  • Visual Studio 2017 provide the option to associate the test case with the test written in the assembly. This association can be done using Test Explorer. When we select the Associate Test Case option, we need to provide the test case by giving the test case id.
Mac

Your csproj file should end up looking similar to this. Notice how much cleaner the new format is.

Visual Studio For Mac

From here, write your unit tests as you would for any project.

Running Tests in Visual Studio

Running tests in Visual Studio hasn’t changed. See my previous post on running NUnit tests in Visual Studio if you have questions.

A few things to note,

  • If you multi-target your tests, only one target will run in Visual Studio, I believe the first
  • Code Coverage is not supported for .NET Core yet, that will be available in a future update to Visual Studio
  • Live Unit Testing is also not available for .NET Core yet

Visual Studio For Mac Tutorial

Running Tests from the Command Line

Visual Studio For Mac Tests Not Running In Parallel

Adding the NUnit 3 Test Adapter to your project will also allow you to use the dotnet test CLI. Here is an example run with the unit tests targeting both .NET 4.5 and .NET Core 1.1.

Visual Studio For Mac

Visual studio for mac tutorial

The tests run for both targets and that you get the output from the dotnet test command, not the normal coloured NUnit output that you would get from the NUnit Console. Hopefully we will be releasing an updated console runner in the near future.