From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Development Best Practices Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Unit Test Framework: Excluding VIs from Code Coverage?

Good morning (at least it is morning right now) all you happy LabVIEW folks!

I have a question about using the Unit Test Framework from NI that I hope some of you can help me with.  I am currently working on one of our re-use libraries specifically to add unit testing and to verify compatibility with LV2012.  I can create the unit tests fine and have learned a lot about using the UTF (Unit Test Framework).  I still am not sure how to use the test vectors exactly but that's not a biggee at the moment.  One feature we hope to take advantage of is the project code coverage calculation that measures how much of your VIs and their composite frames/structures have be tested.  The problem is that all my unit tests count as untested VIs in the calucation so I have a bunch of apparently untested code that I created but in truth they are the tests themselves.  What I am wondering is if it is possible to set a unit test, setup/teardown VI, or user defined test VI to be excluded from the code coverage calculation?  All my searches in the communities and the NI site come up nil so I thought I would bring up the question.

I await your answers/comments with bated breath (okay its really coffee breath but hey).

Thanks

WireWarrior

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 1 of 5
(5,839 Views)

Hi WireWarrior,

The design of the code coverage result is to give out a coverage list for those VIs which have been tested and another list of those which have not been tested.  Just simply divided all the VIs into two groups.

For me, I don't rely on the coverage to figure out the untested file and the file I want exclude from testing. I always put my test related file into a directory, so it is still clear to me for those VIs which do not have a lvtest file are not tested.

Do you have a special needs to get a result that you mentioned in the result summary?

Regards,

HaiJun

0 Kudos
Message 2 of 5
(4,176 Views)

Hello HaiJun,

Thanks for the response.  We have some projects that require a 100% testing metric and if we can programmatically generate that metric so much the better.  If the system outputs the two lists you mentioned then I suppose I could use those and apply my own filtering.  I was just hoping that there was a way to exclude a virtural folder or disk folder from being included in the metric.

Thanks

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 3 of 5
(4,176 Views)

In the meanwhile, is there any solution to this problem about excluding VI's from Code Coverage?

I am using UTF within LV 2013 and in my project I'm using some VI's from openG library. Now, the whole library is loaded into the project, but most of the vi's are not used but are counted nontheless in the Code Coverage which is as a Result only around 30%.

0 Kudos
Message 4 of 5
(4,176 Views)

Hi urssieg,

I think you can exclude the untested VI by unchecking the following option. Please have a try and see if it is what you want.

Project Properties -> Unit Test Framework page -> Project Code Coverage -> Include VIs that were not tested.

2.png

0 Kudos
Message 5 of 5
(4,175 Views)