Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] bad-indent when using data-driven style tests with [Tags] #758

Closed
Zeckie opened this issue Nov 16, 2022 · 0 comments · Fixed by #805
Closed

[Bug] bad-indent when using data-driven style tests with [Tags] #758

Zeckie opened this issue Nov 16, 2022 · 0 comments · Fixed by #805
Labels
bug Something isn't working

Comments

@Zeckie
Copy link

Zeckie commented Nov 16, 2022

What happened?

When using data-driven style tests, and including [Tags], robocop gives errors like foobar.robot:15:37 [W] 1008 Line is over-indented (bad-indent)

For the robot file:

*** Settings ***
Test Template       Login with invalid credentials should fail

*** Test Cases ***                  USERNAME            PASSWORD
Invalid User Name                   [Tags]              foo
                                    invalid             ${VALID PASSWORD}
Invalid Password                    [Documentation]     foo
                                    [Tags]              bar
                                    ${VALID USER}       invalid
Invalid User Name and Password      [Tags]              baz
                                    invalid             invalid
Empty User Name
                                    ${EMPTY}            ${VALID PASSWORD}
Empty Password                      ${VALID USER}       ${EMPTY}
                                    [Tags]              spam  eggs
Empty User Name and Password        ${EMPTY}            ${EMPTY}


*** Keywords ***
Login With Invalid Credentials Should Fail
    [Arguments]    ${username}    ${password}
    No Operation

Editing the lines with errors (removing spaces until it no longer gives any indentation related errors) gives the following. It looks like it is subtracting the length of the test case name from the number of required spaces.

*** Settings ***
Test Template       Login with invalid credentials should fail

*** Test Cases ***                  USERNAME            PASSWORD
Invalid User Name                   [Tags]              foo
                   invalid             ${VALID PASSWORD}
Invalid Password                    [Documentation]     foo
                                    [Tags]              bar
                                    ${VALID USER}       invalid
Invalid User Name and Password      [Tags]              baz
      invalid             invalid
Empty User Name
                                    ${EMPTY}            ${VALID PASSWORD}
Empty Password                      ${VALID USER}       ${EMPTY}
                      [Tags]              spam  eggs
Empty User Name and Password        ${EMPTY}            ${EMPTY}


*** Keywords ***
Login With Invalid Credentials Should Fail
    [Arguments]    ${username}    ${password}
    No Operation

Related robotidy issue: MarketSquare/robotframework-tidy#443

Operating System

No response

Robocop version

2.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant