issue: can not overwrite setUp and tearDown in SubClasses

Recommended Posts

Why are setUp.vi and tearDown.vi not Dynamic Dispatch VIs? This does not look like xUnit style for me.

I would like to create an abstract test class (inheriting TestCase) which containts setUp and tearDown. This would be used by all Test Case Classes which inherit from this class. But this does now work. The VIs are not called when running a TestCase. And they can not be overwritten in a SubClass.

I suggest to define setUp.vi and tearDown.vi in the TestCase class as Dynamic Dispatch VIs. This would have the following advantages:

Easy creation in a Test Case Class by creating an overwrite VI.The VIs in each class are not necessary anymore. (Mine are often unchanged. Therefore I delete them.)

setUp.vi and tearDown.vi can be defined in a parent class

and they can be overwritten in a subclass

Not sure how the transition to the dynamic dispatch VI should be done. When introducing them in TestCase.lvclass, all former test classes are broken. So maybe the new methods should have a different name (set_up.vi, set Up.vi, ...). The implementations in TestCase.lvclass could call the old VIs.

The current workaround is to call VI of the parent class in the setUp.vi of the concrete test case. The called VI can be a dynamic dispatch VI.