-
-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Why is it that if you apply an attribute that implements ITestStartEventReceiver to a test class which also happens to have a [Before(Test)] method, the [Before(Test)] hook inside the test class is executed prior to the attribute's ITestStartEventReceiver.OnTestStart? I would argue this is the wrong order and violates developer expectations.
This could be undesirable in a lot of (if not most) cases; generally when you're using an attribute to perform some initialization upon test start, you want to have it run before anything else in the test pipeline runs (e.g. [Before(Test)] hooks, which may rely on the attribute's ITestStartEventReceiver.OnTestStart method having initialized things).
Was this a deliberate design decision? If so, I would like to hear the rationale, and would suggest including that in the documentation.
Also, is there any kind of workaround to swap the order? If not, how should scenarios of the kind I mentioned be achieved in TUnit?