Skip to content

Testcases that use [Template] are not aligned by AlignTemplatedTestCases #741

@MobyNL

Description

@MobyNL

Issue:
When I have a testcase that uses [Template] to turn it into a templated testcase, it is not aligned when AlignTemplatedTestcases. I'm using a pyproject.toml file to specify the rule

[tool.robotidy]
line_length = 140
transform = [
   "AlignTemplatedTestCases:enabled=True",
]

When I have a test like this it works:

*** Settings ***
Test Template    Run Test Template

*** Test Cases ***
Test Template To Check Formatting
    arg1=value1    arg2=value2    arg3=value3
    arg1=second_value1    arg2=second_value2    arg3=second_value3
    arg1=third_value1    arg2=third_value2    arg3=third_value3

*** Keywords ***
Run Test Template
    [Arguments]    &{variables}
    Log Dictionary    ${variables}

It formats my test to (which in my IDE looks fine, github a bit less):

*** Test Cases ***
Test Template To Check Formatting
    arg1=value1             arg2=value2             arg3=value3
    arg1=second_value1      arg2=second_value2      arg3=second_value3
    arg1=third_value1       arg2=third_value2       arg3=third_value3

When I have a test like:

*** Test Cases ***
Test Template To Check Formatting
    [Template]    Run Test Template
    arg1=value1    arg2=value2    arg3=value3
    arg1=second_value1    arg2=second_value2    arg3=second_value3
    arg1=third_value1    arg2=third_value2    arg3=third_value3

The formatting is not set. If I apply it myself, the formatting is then undone by robotidy, taking away the readability of my template testcase.

Desired solution:
Testcases that are marked with the setting [Template] are also aligned by the rule AlignTemplatedTestcases, or another rule is created that does this for these specific testcases.

(I understand the implementation to robocop is currently more important, but we could change the issue to the (new) robocop repo when that is finished too).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions