A. Use Project Attributres:
Please refer to this blog entry for the below suggestion as it gives examples on how to use Project Attributes:
With a protocol script in Workbench the user credentials are usually hardcoded in the script, or included in the project attributes.
You can use "Project Attributes". In the Monitor Workbench, look under Project -> Project Attributes. Define a project attribute for user name and also for password. Make the password to have type password and it will not be in the clear, it will be obscured. See the online help.
To set-up Project Attributes for passwords do the following :-
1. Choose Project - Project Attributes
2. In the name field give the attribute a name (e.g My_Password)
3. In the Type field choose "password" from the drop-down list.
4. In the Value field enter a password you wish to use in your script.
Now in the script put the following code into a transaction.....
var sPassword : string;
AttributeGetString ("My_Password", sPassword, sizeof (sPassword)); writeln (sPassword);
You can then use the variable sPassword anywhere that it is required in your script.
NOTE: Project attributes are case sensitive
FROM THE ONLINE HELP:
Project attributes are name-value pairs with some additional information, which can be defined for a project. Each virtual user is initialized at runtime with these attributes. A useful scenario is to parameterize the BDL scripts on the project level.
Project attributes can be defined in BMC TM ART Monitor Workbench's ProjectProject Attributes menu. An attribute consists of a name, a type, a value and a default value. The type specifies the way how the value and the default value of an attribute should be interpreted.
Possible attribute types are:
Depending on the type of the attribute, the project attributes can be accessed in the script via the following BDL functions:
Note: The name of an attribute is case sensitive.
•AttributeGetString: for type "string"
•AttributeGetInt: for type "numeric"
•AttributeGetDouble: for type "float"
•AttributeGetBoolean: for type "boolean"
B. Another possibility that does not involve the use of project attributes, is to have the password value read from a text or csv file which is stored on the execution server computer. This way, if you wish to update the password you need to edit this file.
C. Here are some notes on possible code in the script using an unformatted file (not a spreadsheet file).:
FOpen(hFile1, "c:\\somefolder\\username.txt", OPT_FILE_ACCESS_READ, OPT_FILE_OPEN, OPT_FILE_SHARE_READ);
FRead(hFile1, sUser, 30);
FOpen(hFile1, "c:\somefolder\\userpassword.txt", OPT_FILE_ACCESS_READ, OPT_FILE_OPEN, OPT_FILE_SHARE_READ);
FRead(hFile1, sUser_Pass, 30);