TS Synthetic -Project Attributes

Version 8
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    Borland Silk Performer Synthetic Transaction Monitoring


    COMPONENT:

    Borland Silk Performer Synthetic Transaction Monitoring for BMC Software



    QUESTION:

    Using Project Attributes


    ANSWER:

     

                         



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

    A. Use Project Attributres:

    Please refer to this blog entry for the below suggestion as it gives examples on how to use Project Attributes:

    https://communities.bmc.com/community/bmcdn/service_assurance/bmc_application_management/blog/2017/03/21/trending-in-support-how-to-avoid-changing-your-silk-performer-scripts-to-change-a-password-or-other-variables-that-frequently-change  

    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.....


    Transaction TInit

    var sPassword : string;

    begin

    AttributeGetString ("My_Password", sPassword, sizeof (sPassword)); writeln (sPassword);

    end TInit;


    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
    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: 

    •string 

    •numeric 

    •float 

    •boolean 

    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);
    FClose(hFile1);

    FOpen(hFile1, "c:\somefolder\\userpassword.txt", OPT_FILE_ACCESS_READ, OPT_FILE_OPEN, OPT_FILE_SHARE_READ);
    FRead(hFile1, sUser_Pass, 30);
    FClose(hFile1);

    WebSetUserAuthBasic(sUser, Decrypt(sUser_Pass));

     


    Article Number:

    000123383


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles