LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Classes, RT and Unit Testing Framework Error

I'm having an issue running some unit tests on some of the classes that I've created for an RT target; about 2/3 of the tests error saying the library is locked and so the unit tests cannot be run.

 

LabVIEW appears to lock classes (and libraries) they're used on more than 1 target (e.g. standard PC and RT) and when classes are locked the unit tests thrown the error described above i.e. reporting the library is locked. (As an aside, why? It doesn't seem to make sense to lock the libraries in this instance and it makes even less sense to not do unit tests, which shouldn't affect the unit under test.)

 

However, currently my classes are ONLY deployed on the RT target and it is still throwing this error, saying the library is locked.

 

For the tests that do work, the classes appear to get deployed to the RT target during the testing and so the tests are executed on the RT target as expected.  However, for the tests that fail, LabVIEW doesn't appear to be trying to deploy them to the RT target (it doesn't even attempt to connect if its disconnected).  This MIGHT explain why the classes become temporarily locked; if the unit tests are executed on the development machine, LabVIEW could create a temporary in-memory dependency on the class therefore locking it.  This seems to mean that running the tests causes and error meaning the tests do not run.  Note, it can happen where some tests in a class run and some tests in a class error, so I don't believe there is a problem with the way I'm defining classes.

 

I don't want the tests to execute on the development machine.  And I definitely have a preference for tests actually running.

 

Has anyone seen this happen or know how to fix it?

 

Many thanks,

0 Kudos
Message 1 of 6
(2,941 Views)

Hello,

 

here is a forum page that discuses a similar issue.

Maybe you can get some useful hints out there.

 

And if you want know more about how to Lock/Unlock classes, please check here!

 

Did it reply to your question so far?

 

Greetings and Regards,

James.

 

Greetings and Regards,
James
0 Kudos
Message 2 of 6
(2,882 Views)

Thanks for the response.  It's interesting to see library locking issues have persisted for so long and still not fixed despite the best intentions.

 

Unfortunately it doesn't answer my question, though it does add more information.

 

My problem is that when some of the unit tests (about 2/3 of them) execute, they appear to execute on the PC, not the RT target.  As far as I know I have not told it to do this (in the project explorer everything sits under the RT target).

 

Because the tests are executing on the PC, an in-memory dependency seems to be created; I can see the class get added to "My Computer -> Dependencies -> Items in Memory" when I click "Run" on the unit tests.  Because there is now, for running the unit tests, a dependency on the PC as well as the RT for the class, the class is locked.  Unit tests don't seem to run on locked classes (does anyone know why this is?).  The unit test errors.  As soon as the unit test errors and stops, the in-memory dependency is released and so the lock is released.

 

Running the unit test is literally causing unit test to fail.  This can't be correct behaviour.

 

Is there reason why the tests would be executed on a different target?  Or any way to force the execution of tests on a specific target?

 

I'm using auto-populating to keep track of the VIs on the RT target (the 'root' auto-populating folder is on the RT target); might this be causing an issue (e.g. it's left ambiguous as to which target individual VIs should execute on)?

 

Many thanks,

 

Matthew

0 Kudos
Message 3 of 6
(2,878 Views)

Hello,

Thanks for your response and the explanation …

In my previous suggestion, I posted a link (mainly the second one) on how to lock/unlock classes in LabVIEW… But I forgot to precise, that it is only if you want to password-protect your classes. (now I notice, this is not what you were looking for… sorry for this)

Since you still didn’t fix the problem, I would recommend that you upload your VI, for easy searching for possible solutions.

 

Greetings and Regards,

James.

Greetings and Regards,
James
0 Kudos
Message 4 of 6
(2,875 Views)

I appreciate the reply. Unfortunately I can't upload any VIs due to restrictions at work.

 

The more I look, the more the problem seems to be that, for some reason, the test are being executed on my development PC and not the RT target.  Does any one know why they might execute on a different target?  Or how to force unit tests to execute on a specific target?

 

Does anyone know why unit test error if the library of the VI they're testing is locked? Surely they don't change it...?

 

Thanks,

0 Kudos
Message 5 of 6
(2,849 Views)

Hello,

Could you please tell me following:

  • How is the unit test configured?
  • Is it possible to reproduce the behavior with a dummy project and post it here?
  • Where is the tested VI located in the project?

Like that I will have something that I can start with.

 

Greetings and Regards,

James.

Greetings and Regards,
James
0 Kudos
Message 6 of 6
(2,837 Views)