Wednesday, February 27, 2019

Nunit Attributes

NUnit Attributes
 
  • [TestFixture]
    • Marks a class that contains tests

  • [Test]
    • Marks a method in a test class. The method becomes a test case.

  • [SetUp]
    • Marks a method which is executed just before each test method.
    • At most one such method per test class


  • [TearDown]
    • Marks a method which is executed after each test method.
    • At most one such method
    • Is not executed if a test fails, of if it throws an exception



  • [TestFixtureSetUp]
    • Marks a method which is executed once before execution of any test method.
    • At most one such method
    • Executed once, before the execution of the first test method in this fixture



  • [TestFixtureTearDown]
    • Marks a method which is executed once after all tests are completed.
    • Executed once, after the execution of the last test method in this fixture
    • At most one such method



  • [ExpectedException(ExceptionType)]
    • Marks a test which is expected to lead to a given Exceptiontype

  • [Category("name")]
    • Categorizes a given test fixture or test
    • Individual categories can be included or excluded in a test-run


  • [Ignore]
    • Marks a test method or a test class which (temporarily) should not be executed

No comments:

Post a Comment