Azure DevOps, Scrum, & .NET Software Leadership and Consulting Services

Introducing Slide Speaker: Videos with Voice-over from your PowerPoint and Google Slides Presentations

NUnit Test Attribute Execution Order


I went looking to find the order in which NUnit executes the test attributes/events.  Oddly enough, I couldn’t find it.  (Maybe I’m not googling it properly.)


Anyway, here’s the NUnit attribute event order:



  1. TestFixtureSetUp
  2. SetUp
  3. Test
  4. TearDown
  5. Repeat steps 2, 3, and 4 for each test that’s being run in this fixture.
  6. TestFixtureTearDown

-Ben

SUBSCRIBE TO THE BLOG


One response to “NUnit Test Attribute Execution Order”

  1. Pavel Avatar
    Pavel

    Well, TunaBomber, that’s the theory. But in reality, the impact on productivity of that is just too much of a cost for keeping a purist approach. I just tired of having to add massive set-up and tear-down to each test in order to compensate for a lack of support for ordered execution in NUnit GUI. So went searching for a way around… At least I learned the diff between SetUp and TestFixtureSetUp – thanks Ben.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.