HowToWriteGoodTestCases
HowToWriteGoodTestCases copied to clipboard
Variables naming convention
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:
- I can select the whole variable name by a double-click and see where it's used (because PyCharm highlights it)
- when searching & replacing a variable name with underscores it's less likely that I would accidentally replace some part of a code I don't want (test case name or documentation - these usually contain the spaces between words)
Example of our naming convention: ${GLOBAL_VARIABLE} ${keyword_parameter}
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.
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.