This topic describes project, project suite and keyword test variables of the Password type. The topic contains the following sections:
About Password Variables
Projects, project suites and keyword tests can have variables of the Password type. These variables store an encrypted string that can be used by the
Keys methods to simulate input of encrypted data. The values of these variables can be used by these methods only. You cannot use these values in any other way.
The behavior of variables of this type differs from the behavior of other variables:
Keysmethods can properly access the values of Password variables. Other methods get a special variable moniker and the path to the variable instead of the variable value itself.
Keysmethod inputs the value of a Password variable in a control, neither the value, nor the image of the control containing the value is posted to the test log.
Password variable values are masked by special symbols in TestComplete.
On the Variables page of the Keyword Test, Project or Project Suite editor, you can only reset a Password variable; there is no way to edit its value.
Creating Password Variables
You can create Password variables in several ways:
During test recording, password variables are created automatically when you type passwords into password controls. In this case, TestComplete stores the entered password values in password variables:
If your passwords are recorded as text stings and are not masked in tests, make sure the Tools > Options > Engines > Recording > Record text input into simple editors as option is set to SetText (the default value).
For more information, see Recording Passwords.
To create a new password variable, click Add Variable on the page toolbar.
You can create a password variable from your tests. For this purpose, you can use the
Note: It is recommended to avoid storing passwords as plain text in your scripts. You can create a user form or use the
BuiltIn.InputBoxmethod to ask the user to enter a password.
Project.Variables.AddVariable "PasswordVar", "Password"