Build/Test Issues

ClassInitializeAttribute from Base Class isn't executed (MSTest)

Started by MatthewSteeples on 2,580 views

See https://github.com/matthewsteeples/testattributes for a repro

If you run the DerivedTestMethod1 test, the following methods _should_ be executed

* ClassInit.AssemblyInitialize
* ClassInit.ClassInitMethod
* DerivedClassInit.ClassInitMethod2
* DerivedClassInit.DerivedTestMethod1

The 2nd bullet point does not get executed by NCrunch, but does by MSTest
Hi, thanks for sharing this.

Yes, we have no handling for InheritanceBehavior.BeforeEachDerivedClass. I'll take a look and see if we can find a way to introduce it.

Edited

Hi Remco,

Just wondering if you'd had chance to have a look at this yet? Not necessarily the InstanceBehaviour attribute but the ability for multiple ClassInit methods to be called.
Sorry, we've pretty snowed under with V5 work at the moment. I hope to get to this issue later in the year. I'd recommend adapting your code with a workaround for the time being, I don't think I'll be able to provide a fix for this in the short term.

Post a reply

Log in to reply.