NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass username to frontend callback in TestStand

Hi,
I'm currently developing OperatorInterface using MSVC++6.0 for TestStand on top of "SimpleMFCOperatorInterface" from examples.
We have need to provide also automatical test-execution (To run in the middle of the night for example).

Something like:
"operatorInterface.exe -s Sequence [-e EntryPoint -u OperUsername -p Passwd]"


The question is - how automaticly log in "OperUsername", possibly with password checking.

I've read article "How To Avoid Displaying a Login Dialog Box ..." and its clear that we can set AutoLoginName variable in SequenceEditor. But we need somehow to PASS this name from Operator Innterface to LoginLogout callback.

Also it is possible to place "OperUsername" in .txt file an
d read it via PropertyLoad, but it doesn't seems to be the best solution.

Some source code would be great!
0 Kudos
Message 1 of 2
(3,454 Views)
Hi,
I think this is going to take a bit more manipulation than just modifying the OI code. At some point of starting the OI, you'll make the call to load the FrontEndCallback. My thought would be to make your own sequence in the sequence file (so you maintain backward compatibility) and call this instead of the LoginLogout. You can then use the frontend.dll source code (in \components\ni\callbacks\frontend)
as a road map for the login procedure. This is going to be quite tricky as the whole login procedure runs one of two ways : 1) System login (aka auto) uses a match on the username only (and doesn't check passwords) or 2) Useing the dialog box which you can actually pass a password to. This second option returns a UserHandle which you can check t
o see if it's valid or not. If it didn't match - no UserHandle. You can use a fake keystroke to "hit" the OK button to get the login performed.

The other option is to use the operating systems login and do the automatically login with windows username instead - with WinNT you can't create a windows user on the fly - have to have admin rights and add a new user - so it's fairly secure.

I think the easiest option though, is going to be to get the user object from Engine.GetUser(LoginName), and if a match is found, then call the method of the user object you have of validate password.
All TS does then is take in the User Object as the CurrentUser (TS_EngineSetProperty)

Sorry - don't have MSVC++ to do a demo though I've done a quick example in TS 2.0.1f1 just useing the objects.

S.

S.
// it takes almost no time to rate an answer Smiley Wink
Message 2 of 2
(3,454 Views)