Jump to content

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.




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.