JKI Blog

Unit Testing VI Properties

Mar 18, 2009 12:00:28 AM Published by Jim Kring Leave a comment

Have you ever set a reentrant VI to non-reentrant in order to facilitate debugging, only to forget to set the VI back to reentrant when you're done?  This mistake can be very tough to debug, as the difference in behavior (between reentrancy and non-reentrancy) can be very subtle.  The same is true for other VI Settings (e.g. the subroutine Execution Priority setting).  The point is, during development you may change some VI Properties in ways that make sense for debugging, but will cause bugs in your application if left that way.  Forgetting to reset them to their correct values can cause huge headaches when your software is delivered (or worse, long after it's delivered).

How can you ensure that important VI Settings are correct for specific VIs, prior to deployment?

That's easy, just create a unit test (using VI Tester) that validates the required setting, as shown below:

 

Unit Test for Required Reentrancy

 

The VI that performs the reentrancy check, passIfReentrant.vi (shown below), is one that you probably haven't seen before, since it's not delivered as part of VI Tester.

 

passIfReentrant.vi

 

If we look at the block diagram, shown below, we'll see that it's not very complicated:

 

passIfReentrant.vi Block Diagram

 

This VI simply checks the reentrancy and outputs a descriptive test failure message explaining the details of the failure.  When we run our unit tests, prior to building and deploying our application, VI Tester catches the problem and shows us exactly where to look.

 

VI Tester showing failure

 

If you'd like to add reentrancy tests to your LabVIEW application's unit test suite, you can download passIfReentrant.vi here:

If you have ideas for other common, reusable VI Settings (or other) tests, please share your ideas by leaving us a comment below.

How to get VI Tester

VI Tester is available on the VI Package Network. If you're already a VI Package Manager user, just click the "Check the VI Package Network for Available Packages" button in the VIPM window. VIPM will notify you that VI Tester is available, and you can simply tell VIPM to download & install it for you.

 

check-network-for-pkgs

 

If you're not already a VI Package Manager user, what are you waiting for? VI Package Manager lets you take control of your reusable VIs, and is also the best way to put all the great tools from JKI Labs, OpenG.org, and the whole VI Package Network into your palettes!

For more information about VI Tester, visit jkisoft.com/vi-tester.

Tags: VI Tester

Subscribe to Email Updates

Recent Posts

Posts by Topic

see all