pktl Posted August 21, 2019 Report Share Posted August 21, 2019 (edited) Hi, I want to unit test methods in my classes using JKI's VI Tester. Some methods are private or protected, which means, the TestCase class can't access it. (Yeah, I know, testing private methods is controversial for some people, but I want to do it anyway 😛.) My approach is, to save the access scope of every vi in the class that I want to test. Then set all members to 'public' in the test setup and finally restore to the original setting in tear down. The problem is: Everytime the 'Set Source Scope' or 'Set Source Scope And Propagate' library method is called with a dynamic dispatch method, a warning pops up. Quote You have changed the access scope of <vi name>... Would you like to make all the implementations match the access scope of this implementation? This requires me to click a button, which I wanted to avoid in the first place by programmatically changing the access scope 😬. My question: Is this dialog suppressable or automatable somehow? At least 'Set Source Scope And Propagate' should not result in a popup. Its sole purpose is change the scope and propagate that change. (Generally, calling invoke nodes shouldn't popup anything, IMHO.) I could also set the access scope to 'community' and add the test classes as friends, but that seems like an ugly workaround... Edit: By the way: I'm using LV 2018 SP1, if that makes a difference. Edited August 21, 2019 by pktl Quote Link to comment
MikaelH Posted August 21, 2019 Report Share Posted August 21, 2019 There is a brown/private property node that can suppress all dialogs. If you don't have access to this property node, you can find a sub VI that does this for you here. Â Quote Link to comment
pktl Posted August 22, 2019 Author Report Share Posted August 22, 2019 Thanks for the advice. Unfortunately it doesn't work with this dialog box. Maybe I have to resort to some mouse click simulation tool. Quote Link to comment
Aristos Queue Posted August 28, 2019 Report Share Posted August 28, 2019 pktl: Yuck. I don't know how long *that* has been broken. We shouldn't be prompting from the scripting method. I'll file a bug report for it. The gUnattended does repress the dialog box, but it also makes the scope change *not* propagate, which defeats the purpose. Quote Link to comment
pktl Posted August 29, 2019 Author Report Share Posted August 29, 2019 Thanks AQ. After posting here, I also opened a support ticket. I guess, I can close that now. By the way: NI's Unit Test Framework seems to work even with private methods. One can see the access scope changing in the project when the tests are running. At a cursory glance, the UTF is just 'regular' LabVIEW. So I wonder how that works or what the workaround is. 1 Quote Link to comment
Aristos Queue Posted August 29, 2019 Report Share Posted August 29, 2019 I suspect UTF uses "Set Scope", which is a separate method that doesn't do the propagation. The UTF authors may have written their own propagation loop. You could use the same workaround (I acknowledge how annoying that would be to write, but at least the option exists). BTW, looking at code, turns out that the "And Propagate" version was written to always prompt. That's how the Library Properties dialog works. On my machine as of this morning, there's a new Boolean parameter to "skip prompt" on that method. 1 Quote Link to comment
pktl Posted August 29, 2019 Author Report Share Posted August 29, 2019 I could have sworn that the same popup also appeared when I tried the 'Set Scope' method... 🤔 But you are right. No popup when using it instead. Actually, for my application, using 'Set Scope' is probably good enough. 28 minutes ago, Aristos Queue said: On my machine as of this morning, there's a new Boolean parameter to "skip prompt" on that method. Nice! Can you estimate if and when it's released? Quote Link to comment
Aristos Queue Posted August 30, 2019 Report Share Posted August 30, 2019 Quote Nice! Can you estimate if and when it's released? Ask the others on this forum... they'll tell you I try never to promise future functionality. All sorts of things can conspire against a feature. I mean, everything from a malicious server virus wipes out all of last week's code changes across all backups to NI deciding to "change course" and go into knitting and not releasing any more software. But... taking all of that into account... you can have some faith that it'll be in the next full version of LabVIEW, sometime next year. If there is a next year... 🙂 1 Quote Link to comment
hooovahh Posted September 3, 2019 Report Share Posted September 3, 2019 On 8/30/2019 at 4:43 PM, Aristos Queue said: you can have some faith that it'll be in the next full version of LabVIEW, sometime next year. If there is a next year... 🙂 Breaking News: R&D expert at technology company predicts the end of the world within the next year! 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.