Lecture overview -- Keyboard shortcut: 'u'  Previous page: NUnit for C# -- Keyboard shortcut: 'p'  Next page: NUnit Assertions -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 25 : 35
Object-oriented Programming in C#
Test of Object-oriented Programs
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

Consult the NUnit documentation for the full and exact set of test-related attributes