Unit Testing Group

cancel
Showing results for 
Search instead for 
Did you mean: 

Excluding LVTEST Files from Build

Solved!
Go to solution

Recently, I've taken over a project that is a packed project library which gets compiled along with some dependent libraries and then copied into other projects. Until I added unit tests, there were only about 3 output files and this method of doing things wasn't likely to introduce errors. However, now I have about 30 test files that get output with the library, and it's starting to look like it may be an issue in the future. 

 

Is there a way to exclude the lvtest files from the final build? 

 

The directory structure looks like: 

  • Library 1
  • Library 2
  • This Library
    • Folder 1
      • VI1
      • Test1
      • Vi2 
      • Test2
    • Folder 2
    • Folder N
    • VI 1
    • Vi 2

The output directory looks like: 

  • Library 1
  • Library 2
  • This Library
  • Test 1
  • Test 2
  • Test N

The goal is to either wrap all of the lvtest files into the library, or outright remove them from the output. Currently, if I just delete them after, I get errors that they are missing when I use the library. In the build menu, the library is automatically added and all of the lvtest files are by default set to Always Included and there is no way to change that. 

 

 

0 Kudos
Message 1 of 3
(2,496 Views)
Solution
Accepted by topic author MDumas

I've solved this problem, and I figured I'd post in case someone else has the same issue. 

 

Originally, I had read somewhere that you needed to leave the tests in the directory that they were created in. However, this isn't true. The VI location in the file is relative, so you can put them wherever you want, as long as you update them. Here's what I did: 

 

  1. Create a virtual folder in the project and move all unit tests to it.
  2. Edit the build options so that this folder isn't included. 
  3. Run all the tests. (Moving them into the virtual folder ended up revealing some errors in the files for me)
  4. Fix the errors introduced by moving the files. 

In my case, two of the files needed to have their VI under test path fixed. 

 

 

Message 2 of 3
(2,485 Views)

This is what I regularly recommend. We have our project at the top level of your disk hierarchy. 

From there, we have a folder for Unit Tests, a folder for Libraries and/or Classes, a folder for documentation, etc.

 

The main reason I give to have the Unit tests in a different folder is exactly what you found out, it is a lot easier to exclude a whole folder from a build. 

 

Unit Test Framework sometimes makes it difficult to move unit tests to a different folder, but as you found out, it is just a matter of changing the relative path to the unit under test.

 

Glad you were able to figure it out.

 

Regards,

Fab

 

 

For an opportunity to learn from experienced developers / entrepeneurs (Steve, Joerg, and Brian amongst them):
Check out DSH Pragmatic Software Development Workshop!

DQMH Lead Architect * DQMH Trusted Advisor * Certified LabVIEW Architect * Certified LabVIEW Embedded Developer * Certified Professional Instructor * LabVIEW Champion * Code Janitor

Have you been nice to future you?
0 Kudos
Message 3 of 3
(2,481 Views)