Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore entire unit test project using NUnit and ReSharper

I have a Visual Studio solution which contains a number of C# unit test projects based on NUnit. Our TeamCity environment selects the specific unit test DLLs to run. However, when running the unit tests in the solution locally using ReSharper, it runs everything. Is there a way of ignoring entire projects without having to put the Ignore attribute on every single test fixture?

like image 798
Neo Avatar asked Jan 16 '14 12:01

Neo


People also ask

How do I ignore test cases in NUnit?

IgnoreAttribute (NUnit 2.0) The ignore attribute is an attribute to not run a test or test fixture for a period of time. The person marks either a Test or a TestFixture with the Ignore Attribute. The running program sees the attribute and does not run the test or tests.

How do I ignore a test in Visual Studio?

When you add the [Ignore] attribute, the test will be ignored by the test runner. It will show up in Test Explorer with a warning icon and will count as Skipped.


2 Answers

  1. Tag all the tests in the project with a [Category] attribute.
  2. Exclude the specified category in Resharper's Unit Test settings
    under Skip tests from categories:

enter image description here

like image 62
stuartd Avatar answered Oct 20 '22 04:10

stuartd


As alternative you could also add the Ignore flag to the project assembly which disabled all tests inside.

In AssemblyInfos.cs add:

[assembly: Ignore]
like image 26
Schweigi Avatar answered Oct 20 '22 03:10

Schweigi