JamesMc86 / G-CLI

A proxy mechanism allow LabVIEW programs to easily write out to the command line.
BSD 2-Clause "Simplified" License
71 stars 19 forks source link

Testing with G-CLI #167

Closed felipefoz closed 7 months ago

felipefoz commented 8 months ago

Hi James,

I wonder if there is an easy to mock G-CLI in tests.

The scenario is: I have some VIs that receive the G-CLI class to write values to terminal and they are part of a bigger application

My idea would be to mock the G-CLI to write to anywhere else, nor "Write Line.vi" neither "Write String.vi" are dynamic dispatch, so this makes a lit bit harder to use a mock child class.

Another approach would be for me to wrap G-CLI into another class in my control (definitely wouldn't like to go with this approach).

Have you done something similar? Or do you have any hint?

Regards,

JamesMc86 commented 7 months ago

There isn't really anything built into the G-CLI tool to aid with this, I think you would have to wrap it yourself to mock it. I know others have done this before (including to also switch between a G-CLI and GUI mode in their tools)

felipefoz commented 7 months ago

Thanks for the response.

Is this somewhere in the G-CLI roadmap? To create some dynamic dispatch methods of the common functions?

JamesMc86 commented 7 months ago

No there are no plans right now and I feel it would be a little unusual to build something in at this level of a library. This is normally better done at an application level with a better knowledge of the expected interface and ways to mock it.

I'm not saying I can't be persuaded - but right now it feels like a low priority

felipefoz commented 7 months ago

Fair enough, just adjusting expectations.

Thus, closing this issue.

Thanks for the quick feedback.