Jump to content

Suggestion: test classes inherit test methods

Recommended Posts

The class SubCase.lvclass inherits from the test case myTests.lvclass (inheriting TestCase.lvclass). When loading SubCase.lvclass in VI Tester only the tests defined in this class are shown. I expected to also get the test VIs from the parent class. At least this is what I am used to from python unittest.



I tried this because I have similar VIs I want to do 3 test on each. The connector pane of the VIs are similar, but some data types are different. So I wanted to handle this differences in a VI which is used in all 3 tests. In the subclasses I wanted only to overwrite this VI.

My words are probably unclear, maybe this structur explains more.


myTests_A.lvclass, inheriting TestCase.lvclass


Test 1.vi, calling CommonVI.vi

Test 2.vi, calling CommonVI.vi

Test 3.vi, calling CommonVI.vi


myTests_B.lvclass, inherinting myTests_A.lvclass


Share this post

Link to post
Share on other sites

This is an interesting idea and one we've thought about as well. One question I have - if you run the parent test case directly, do you skip execution of the tests in the parent class? How does the parent test case get treated? Ideas are welcome.

Share this post

Link to post
Share on other sites

I see several possibilities: (parent class is myTests_A.lvclass)

  • mark the parent class as abstract
  • use the skip VI in ComonVI.vi in the parent class
  • implement the first test case in the parent class (probably not a clean design)

The decision of choosing the design could be left to the test case writer.


When the parent class is not in the project (only in dependencies), it is not loaded with the project anyway. So it is easy to leave it out.

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.