10-21-2021 05:43 AM
I'm using Caraya to create unit tests for low level VIs of my DQMH modules.
Most of the VIs under test are private VIs of the module.
So to avoid scope restrictions the Caraya Unit Test VI are part of the module (I create a "UnitTest" virtual folder to group them in the lvlib.
I do most of the coding on windows and have no issue there, but sometimes I move to Linux (Ubuntu) to compile an App.
On Linux Caraya doesn't work... so I have broken VIs in my lvlibs and it create headaches.
Other than forking Caraya on GitHub and adding Linux support, what are my options?
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
10-21-2021 07:16 AM
Hey Antoine,
in general, it seems to be best practice to test a DQMH module through its public API. That way, the Caraya Unit Test VIs would stay outside your module's lvlib. I would even recommend saving them outside your projects source folder, because they don't really belong to your application's source code ( - but in the same repository). That way, you would be able to build on linux.
The downside of this approach is, that you cannot test the private subVIs of your DQMH module. One could argue, that it doesn't matter, as long as the public API works correct. But it still feels uncomfortable.
So I would try to create a class outside the module's lvlib, wrapping the core functionality which you want to test without the module. Since it is a public class, you can write another set of Unit Tests against that class. That class could also be used by different modules, in different projects without DQMH, or when you want to change your framework etc..
Having a tested class and a tested DQMH module, there is little need to test the private subVIs of the module. The downside of this approach is, that you will lose some visibility in the DQMH module: A look at one MHL-case might not show as much as before, because the implementation moved in the class.
The implementation of DQMH module communication in the application context on the one side and the functionality of the class (e.g. Hardware Abstraction Layer) on the other side, needs to be separated. E.g. you won't put broadcasts into the class, since it should be useable without the DQMH module. I feel that doing unit tests forces us for a cleaner design, which might be the reason for a headache, but worth it 😉
Just my ideas, I have been running into this problem also a few times and am curious about other solutions.
Alexander
10-21-2021 07:44 AM
Thanks a lot for your suggestions Alex.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
10-21-2021 09:28 AM
One possibility is to use "Community" scope instead of private, with unit tests in a separate library that is "friends" with the first.
10-21-2021 12:06 PM
@AlexElb wrote:
I feel that doing unit tests forces us for a cleaner design, which might be the reason for a headache, but worth it 😉
💜
DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )