Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Improving the clarity of your Silk Performer .bdf scripts

Improving the clarity of your Silk Performer .bdf scripts

Note: this article is part of the Best practices for script and results reuse in Silk Performer article.

3.1 - Importance of Comments
As with any programming language, it is good practice to comment your BDL code. This is not just to ensure that you can recall what each component of script does, but also so that fellow developers (or external consultants) can understand your script. Comments are particularly important where more complex BDL tasks are scripted, or when external functions and files are referenced.

BDL uses the "//" operator for managing comments at line-level. All the characters of the current line following the "//" operator will be marked as a comment. Commented lines will be rendered in a green font in the .bdf script, as follows...

// this is a comment

By default, each newly recorded Silk Performer script will have a basic comment section at the head of the .bdf file, stating when the script was recorded and the version of Silk Performer used, as follows...

//--------
// Recorded 23/10/2013 by Silk Performer Recorder v10.0.0.5729
//--------

This entry should be broadened to include details of script engineer, purpose of script, technical comments and so forth.

Here's an example:

//--------
// Recorded 23/10/2013 by Silk Performer Recorder v10.0.0.5729
// Developer: Andrew Orr
// Team: Applications Performance Management
// Purpose: run "new" and "return" visitors against ShopItV60 application
// Comments: script has been modularised to allow for portability and
// component reusage.
//--------

Block comments are bounded between /* and */. Nested comments are also allowed.

Example:

/*---------------------------------
this is a valid comment
---------------------------------*/

/* this is a valid /* nested */ comment */

3.2 - Naming your variables

You"ll find that agreed naming conventions within your team will prolong the usability of your scripts.

You may already be familiar with the concept of "Hungarian Notation", which lays down how variables should be named, according to type.

The BDL prefix format is as follows (where "var" is fictitious variable):

sVar = string
fVar = float
nVar = number
bVar = boolean;

Where a variable name contains more than a single word, the words should be run together as a single string, with the first letter of each word as a capital letter. For example, "sBillingAddress".

3.3 - Naming your Timers

Custom timers can be set either during initial script recording or in post-recording customization and are extremely useful in providing timed measures (seconds) for specific script components at replay. Again, intuitive naming is essential. For a comprehensive overview on how custom timers can be best used, please refer to the What are custom timers and how can I add them to my SilkPerformer project? Knowledge Base article.

3.4 - Renaming your dclform fields

Intuitive naming of dclform fields will likewise improve your scripts. For instance, an initial "Login" webpage form may be recorded as "FORM_001", a meaningless description... it would increase readability to rename it as "LoginForm".

The following example contains descriptive form-names in the dclform section of the .bdf script:

dclform
  NEW_LOGIN:
    "name"                     := pUserName1,
    "New-Name-Button"          := ""  ;

  SEARCH_PRODUCT:
    "product"                  := pRndFile11,
    "Button"                   := ""  ; 

Remember to replace every instance throughout the script, as form names will also be referenced in the relevant transactions or functions.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 18:40
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.