vipm-io / vi-tester

VI Tester for LabVIEW
BSD 3-Clause "New" or "Revised" License
28 stars 26 forks source link

Set test names/reference in testSuite:New.vi #40

Open chrisb2244 opened 5 years ago

chrisb2244 commented 5 years ago

In testSuite:New we can collect the same test case with some different inputs (for me, different classes in the same object hierarchy) and then run the same test case for the different inputs without code duplication (apologies for the default icons - it's the same test case with two values of a boolean). image

However, in the GUI, there's no good way to see which might be which (that I know of... maybe there is?) image

Would it be possible to make a modification to allow changing the line that appears in the GUI. Then we could have something like image and with/without library/class names (either would be fine, shown here with library but not class which is probably pretty inconsistent and so maybe a bad combination) image (apologies this time for Paint skills)

I suppose a workaround is to have a testCase with a dynamic dispatch "Get Class to Test.vi" and then child classes which just provide the class constant, and implement all the tests in the parent. I haven't tried this to know what the outcome will be in VI Tester but it sounds possible and might give me the appropriate child class names in the GUI... if this is the usual method then my apologies for the unnecessary issue!

chrisb2244 commented 5 years ago

Having just tested this, the behaviour when using two almost empty classes inheriting from the implemented ServerWriterTestCase.lvclass, with just a boolean returning DD VI, is to give a testSuite with no tests (presumably because the actual testCases have no tests, as found by listAllTestMethods.vi) and then have the testCase appear alone, and operate with the default data value (false).

chrisb2244 commented 5 years ago

This modification can be made by adding a section of code to GraphicalTestRunner.lvlib:Initialize Tests on Tree and a new String private data member with read/write accessors in TestCase.lvclass (for test cases - for Suites, I imagine the same thing could be done).

Example images are shown below: image (Initialize Tests on Tree.vi)

image TestCase.lvclass, private data and class members in Dependencies (I just edited the installed files, not the source and rebuilt)

image New.vi in TestSuite.lvclass, using the same class twice and the Write Accessor for "customName".

image GUI Runner showing the two test cases. Other cases still have the usual class name format. All tests are found and still run. Double-clicking on the tests in "test-a" and "test-b" still open the correct VIs.

Are these values (in the GUI Runner) only cosmetic? If so, is this a valid way to edit their appearance?

jimkring commented 5 years ago

Hi @chrisb2244. This is a very good idea -- I can see how having different display names for each instance of a TestCase or TestSuite would be very helpful. I've wanted this, too. I'll review the details of your proposal in more depth, soon. Please do feel free to keep posting your thoughts and ideas about this. I read all the posts :-)