-
Notifications
You must be signed in to change notification settings - Fork 756
Description
NUnit has many attributes that only work when used on the right element.
In the case of Method vs Class vs Assembly, we rely on the compiler to tell us. However, in the case of methods particularly, there are a lot of different sorts of methods in a test fixture and the compiler can't help us. Usually, NUnit just ignores any attribute that is incorrectly placed: for example, if you put a Timeout attribute on a non-test method. Usually, this doesn't cause a problem. 😄
In the particular case of ParallelAttribute some users think it makes sense to accept them on the OneTimeSetUp method. They try it out and NUnit doesn't complain so they wonder why their tests are not running in parallel. I think we have to give some error in this case. I would extend that to NonParallelAttrubte and to OneTimeTearDown, SetUp and TearDown.
Eventually, we may want to generalize this by having all attributes derived from NUnitAttribute specify how they may be used and having NUnit check them extensively. I don't think we should do that in this issue, because we have an ongoing problem with ParallelAttribute that should be resolved quickly.