MarketSquare / robotframework-robocop

Tool for static code analysis of Robot Framework language
Apache License 2.0
182 stars 39 forks source link

[Bug] Test Template with DataDriver Library don't need explicit keywords on test case #1087

Closed Jmateusribeiro closed 4 months ago

Jmateusribeiro commented 4 months ago

What happened?

Test Template with DataDriver Library don't need explicit keywords on test case but robocop assumes as an "issue". Example:

..... Library DataDriver file=data_files\users_data.csv dialect=unix

Test Cases Scenario: Successful Registration With ${email} [Documentation] Tests successful registration with different email addresses from a CSV file. [Template] Scenario Outline: Successful Registration

don't need nothing here

Keywords Scenario Outline: Successful Registration [Documentation] Registers a user with the given email and password, then verifies the correct token is returned. [Arguments] ${email} ${password} Given Email And Password Are Defined As ${email} And ${password} When Registration Is Executed Then The Correct Token Is Returned

What command/code did you try to run?

Robocop

What is the full error message?

issue: [E] 0528 Test case 'Scenario: Successful Registration With ${email}' has too few keywords inside (0/1) (too-few-calls-in-test-case) D:\WORK\Desktop\Projet

What did you expect to happen instead?

Should be ok with no issues

Operating System

windows

Robocop version

5.1.0

bhirsz commented 4 months ago

It's kind of special case - since DataDriver is suppliying information that normally should be present in test suite. We could try to detect if DataDriver was imported and then disable this rule. But I feel it would just unnecessarily complicate the rule. Did you consider disabling this rule in suites that use DataDriver? With # robocop: off disabler https://robocop.readthedocs.io/en/stable/disablers.html

Jmateusribeiro commented 4 months ago

In my opinion this should be adjusted, but what you said can be used to overcome the problem. Thanks

bhirsz commented 4 months ago

I will think about it - since DataDriver is popular library it may be reasonable to do so