MarketSquare / MarketSquare/robotframework-tidy
Testcases that use [Template] are not aligned by AlignTemplatedTestCases
Nobody has claimed this yet.
- Dominant language
- RobotFramework
- Stars
- 113
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
**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
```toml
[tool.robotidy]
line_length = 140
transform = [
"AlignTemplatedTestCases:enabled=True",
]
```
When I have a test like this it works:
```robot
*** 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):
```robot
*** 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:
```robot
*** 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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the difference between the suite-level Test Template and the test-level [Template] examples using the pyproject.toml configuration and AlignTemplatedTestCases. Start by tracing that rule's handling of templated test cases; done means the [Template] form is aligned without the formatter undoing the readable spacing.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100