robotframework-lint
robotframework-lint copied to clipboard
Rule for complex logic in test cases
According to https://code.google.com/p/robotframework/wiki/HowToWriteGoodTestCases#Workflow_tests test cases should not contain complex logic like for loops or if statements. Detecting for loops seems pretty easy, but detecting if/else and variable assignments seems like it might be a little trickier unless you hardcode a list of disallowed keywords, such as Run Keyword If.
Hmmm. I'm not sure we should have a built-in rule checking for :FOR statements. There are definitely some very valid uses. I'll consider it though. Maybe if you have more than one for loop, or nested for loops?
Perhaps a more general solution would be a generic "check for illegal keywords", then you can edit an external file that lists the keywords your team doesn't want to use. You could include ":FOR", for example, if you want to flag uses of for loops.
On Tue, Dec 2, 2014 at 4:08 PM, Guy Kisel [email protected] wrote:
According to https://code.google.com/p/robotframework/wiki/HowToWriteGoodTestCases#Workflow_tests test cases should not contain complex logic like for loops or if statements. Detecting for loops seems pretty easy, but detecting if/else and variable assignments seems like it might be a little trickier unless you hardcode a list of disallowed keywords, such as Run Keyword If.
— Reply to this email directly or view it on GitHub https://github.com/boakley/robotframework-lint/issues/10.
:FOR statements are definitely valid in keywords. I think the "good test cases" guide is just recommending that there be no :FOR loops at the top level of a test case. It's certainly debatable what an acceptable level of complexity is, though.