03-12-2018 08:05 AM
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:
The output directory looks like:
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.
Solved! Go to Solution.
03-12-2018 09:07 AM
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:
In my case, two of the files needed to have their VI under test path fixed.
03-12-2018 09:19 AM
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