Disable all tests in my class [TestClass]

10,701

You can do this by placing the Ignore attribute on your class. If you look at the documentation of the IgnoreAttribute Class you will see that it can be applied both to methods and to classes.

Share:
10,701

Related videos on Youtube

Claysson
Author by

Claysson

Updated on September 14, 2022

Comments

  • Claysson
    Claysson over 1 year

    Can I disable all my tests in my class?

    I am using namespace Microsoft.VisualStudio.TestTools.UnitTesting;

    Single tests can be ignored with the [Ignored] attribute.

    • Daniel Mann
      Daniel Mann over 10 years
      If the tests are failing, fix them or remove them. Don't ignore them.
    • jjaguirre394
      jjaguirre394 over 2 years
      @DanielMann Sometimes the tests cannot be fixed (at that point in time) and you don't want to remove them and lose them all. For example, we had a few tests that had a Nuget dependency that had been deprecated, and the recommended nuget package meant to replace the old one was not supported for C# at the time. This caused issues for us on our build machines. We had a task to fix the tests once we were able to but in the mean time the ignore attribute was very useful.