Forum Discussion
3 Replies
Sort By
- MikeSchmidOccasional ContributorAlternately you can set up a project variable or project suite variable.
Open the project item and click the variables tab. Set up your temporary variable variables. Since you want them hidden leave the default values blank.
Then when you want to populate them all you have to do is set Project.Variables.variable name=value
or ProjectSuite.Variables.variable name=value
And clear them at the end of the run. - Ryan_MoranValued ContributorYou'll want to look at the USEUNIT option as well as creating a global variable by placing it outside all procedures/functions. As far as securing the password you may use something like this for simple encryption/decryption:
'VBS Example
Function encrypt(Str, key)
Newstr = ""
lenKey = Len(key)
KeyPos = 1
LenStr = Len(Str)
str = StrReverse(str)
For x = 1 To LenStr
Newstr = Newstr & chr(asc(Mid(str,x,1)) + Asc(Mid(key,KeyPos,1)))
KeyPos = keypos + 1
If KeyPos > lenKey Then KeyPos = 1
Next
encrypt = Newstr
End Function
Function decrypt(str,key)
Newstr = ""
lenKey = Len(key)
KeyPos = 1
LenStr = Len(Str)
str=StrReverse(str)
For x = LenStr To 1 Step -1
Newstr = Newstr & chr(asc(Mid(str,x,1)) - Asc(Mid(key,KeyPos,1)))
KeyPos = KeyPos+1
If KeyPos > lenKey Then KeyPos = 1
Next
Newstr=StrReverse(Newstr)
decrypt = Newstr
End Function - Philip_BairdCommunity Expert
Hi Don, we follow an approach similar to Mikes except we don't even persist the Project Variables.
Instead, we store all usename/password information in an .ini file, then when tests are run, this .ini file is read and a combination of the following methods are used to create and purge Project Variables containing the credentials:
Project.Variables.VariableExists()
Project.Variables.AddVariable()
Project.Variables.RemoveVariable()
Because the runtime is interpreted, the Project Variables do not need to exist until the code accessing them is executed.
Regards,
Phil Baird
Related Content
Recent Discussions
- 2 days agovladd1