Share This:

NOTE:  This is post contains a sample script.  BMC Support cannot assist in coding or debugging custom scripts

 

Project Attributes allows a user to edit parameters through an Execution Plan without editing the Silk Performer script directly.

 

A good case for this scenario would be a script that uses a username and password on a system where the password changes every few months.  If you have your script configured to use Project Attributes, then you can change the password via the Execution Plan instead of modifying the script.

 

Below is a step by step example of how we can do this:

 

1.  Open Silk Performer

2.  Choose Project - Project Attributes

3.  In the name field give the attribute a name (e.g password)

4.  In the Type field choose 'password' from the drop-down list.

5.  In the Value field enter a password you wish to use in your script.

Project Attributes.png

6.  You can now add code to your script that will pick up this attribute.  Below is some sample code:

---------------------------------------------------------

transactions

    TINIT            : begin;

    UserPassTest             : 1;

                           

var

  sUser   : string;

  sPass   : string;

 

// Transactions Section

dcltrans

 

  transaction TINIT

  begin

    AttributeGetString("ProjectAttributeUsername", sUser_variable);

    AttributeGetString("ProjectAttributePassword", sPass_variable);

  end TINIT;

 

  transaction UserPassTest

  var

 

  begin

   writeln(sUser_variable);

   writeln(spass_variable);

 

  end UserPassTest;

--------------------------------------------------------------

You can then use the variable "sPass_variable" anywhere that it is required in your script. Remember that if you use "sPass_variable" in a form (in the dclform section of the script) then it must be a global variable.

 

NOTE: Project attributes are case sensitive

 

After you have imported your script into TSPS, you can edit the Execution Plan and see your new editable settings.  If you followed the example above, then you should see something similar to the screen shot below:

Execution Plan.png

When the Execution Plan is deployed out to the TEA Agent, it will be passed the parameters from the above fields.  If you want to change the username or password that the Execution Plan is using, then you simply need to come back to the Execution Plan settings and change these values.