Thursday, December 24, 2015

Upgrading to NUnit 3.0 - OneTimeSetUp: SetUpAttribute attribute not allowed in a SetUpFixture

After upgrading to NUnit 3.0, which became recently available, some of my tests started to fail.

When I look at the test results, they all failed with the following error message:

SetUpAttribute attribute not allowed in a SetUpFixture

In NUnit 3.0, there are some breaking changes regarding the usage of the SetUpAttribute and the SetUpFixture.  You can no longer use the SetUpAttribute and TearDownAttribute inside a SetUpFixture. Instead you have to use the OneTimeSetUpAttribute and OneTimeTearDownAttribute.

In NUnit 2.0, I had the following code:

In NUnit 3.0, this has to change to:

More information can be found here:

5 comments:

Anthony Steele said...

Hi

Your nunit doc links are broken.

Thanks for the post, it's the only thing that I can find on the the subject of this error.

Murray said...

Thank-you, your google-juice helped me upgrade a legacy solution quickly. :-)

Unknown said...

Thanks. This helped me get the tests running again.

Sagar R said...

I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Nunit, kindly contact us http://www.maxmunus.com/contact
MaxMunus Offer World Class Virtual Instructor led training Nunit . We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Demo Contact us:
Name : Arunkumar U
Email : arun@maxmunus.com
Skype id: training_maxmunus
Contact No.-+91-9738507310
Company Website –http://www.maxmunus.com



Sagar R said...

I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Nunit, kindly contact us http://www.maxmunus.com/contact
MaxMunus Offer World Class Virtual Instructor led training Nunit . We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Demo Contact us:
Name : Arunkumar U
Email : arun@maxmunus.com
Skype id: training_maxmunus
Contact No.-+91-9738507310
Company Website –http://www.maxmunus.com