robotframework / HowToWriteGoodTestCases

General guidelines for writing good test cases using Robot Framework
406 stars 191 forks source link

Variables naming convention #7

Open lucielavickova opened 5 years ago

lucielavickova commented 5 years ago

Hello,

just as an improvement suggestion - from my own experience it's better to use underscores between words in variable names rather than spaces - it helps a lot (not only) during refactoring:

Example of our naming convention: ${GLOBAL_VARIABLE} ${keyword_parameter}

vmaillol-altair commented 4 years ago

Hello,

I'm not sure than using case to differentiate global variable is a good things because we easily can shadow a global/suite variable using same lower name in a keyword. Perhaps it is better to use dedicated prefix.

adamzovits commented 9 months ago

Hello,

I'm not sure than using case to differentiate global variable is a good things because we easily can shadow a global/suite variable using same lower name in a keyword. Perhaps it is better to use dedicated prefix.

As someone that got bitten by this issue just now, I'll wholeheartedly support this notion to use a prefix for this purpose. We have already used capital letters and underscores for global variable names, but a local variable got declared with a camelcase name (which is treated as equivalent) and the value was reset in the next test case to the globally set value.