Jump to content

Popup warning when using Set Source Scope


Recommended Posts

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 by pktl
Link to comment

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.

  • Like 1
Link to comment

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.

  • Like 1
Link to comment

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?

Link to comment
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... 🙂

  • Haha 1
Link to comment
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!

  • Haha 2
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.