Search Results for

    Show / Hide Table of Contents

    Culture

    The Culture attribute is used to specify cultures for which a test or fixture should be run. It does not affect the culture setting, but merely uses it to determine whether to run the test. If you wish to change the culture when running a test, use the SetCulture attribute instead.

    If the specified culture requirements for a test are not met it is skipped. In the gui, the tree node for the test remains gray and the status bar color is not affected.

    One use of the Culture attribute is to provide alternative tests under different cultures. You may specify either specific cultures, like "en-GB" or neutral cultures like "de".

    Test Fixture Syntax

    namespace NUnit.Tests
    {
      using System;
      using NUnit.Framework;
    
      [TestFixture]
      [Culture("fr-FR")]
      public class FrenchCultureTests
      {
        // ...
      }
    }
    

    Test Syntax

    namespace NUnit.Tests
    {
      using System;
      using NUnit.Framework;
    
      [TestFixture]
      public class SuccessTests
      {
        [Test]
        [Culture(Exclude="en,de")]
        public void SomeTest()
        { /* ... */ }
    }
    

    See Also

    • SetCulture Attribute
    • Edit this page
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0