We need some global one time setup code in our test suite. We can do it more than once but it takes quite some time.
It's required by all fixtures so
[TestFixtureSetUp]
does not work. It has to run before all[TestFixtureSetUp]
code.Put it in
Main()
since we keep test assemblies as executables. HoweverMain
doesn't get executed under GUI client.Creating a separate class with a static constructor for initialization only works when you reference the class which we do not favor doing in each and every class.
Inheriting all test fixtures from a base class and adding a static constructor to it causes multiple calls to the init code.
Now given the circumstances, I have two questions:
1) Is "global setup" a very bad idea that it's not supported by NUnit?
2) What's the least painful, most common way to achieve this?