Off late i was scrambling to understand the code one of the self proclaimed experts wrote. I really had to negotiate my way through.Finally i did.
Therafter i realized how narrow the available expertize is. And this has catapulted me to come up with my series of MG (Masala Gyan) on best coding standards for Automation scripts. I should generalize them but i feel on the contrary because all tools have different set of languages so why not separate standards. Hence i am sticking this series to ONLY silktest.
OK..enough of MG, here i start off with the first thing to be taken cared : "Naming Conventions"
Silk Reserved Words
There are some Silk keywords (if, while, etc.) that must be lower case. The Silk reserved words that do not fall into this category (string, anyType, etc.) should be mixed case where the first letter is lower case and each new word is capitalized. For example:
if (var1 == var2)
listMerge(list1, list2)
Variables
Variable names should be descriptive and should be mixed case where the first letter is lower case and each new word is capitalized. Variable names should include the standard prefixes or suffixes describing the type of variable.
These include:
· i = integer
· s = string
· lx = list of something (li = list of integer, ls = list of string, etc.)
· rec = record
For example:
integer iNumberOfAccounts
list of string lsStringList
string sName
Constants
Constant names should be descriptive and should be all upper case with words separated by underscores.
const string TIER_PRODUCTCODES = “ABC014” // Global constant
Functions/Test cases/Methods
Function names should be descriptive and should be mixed case where the first letter is lower case and each new word is capitalized. For example:
createNewAccount(string sAccountName)
boolean accountExists(string sAccountName)
To be contd...
Friday, September 14, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment