Skip to content

RenameTestCases

Enforce test case naming. This formatter capitalizes the first letter of the test case name, removes the trailing dot and strips leading/trailing whitespaces. If capitalize_each_word is True, will capitalize each word in test case name.

Enabling the formatter

RenameTestCases is not included in default formatters.

You can enable it by using --select and --extend-select options.

robocop format --select RenameTestCases
robocop format --extend-select RenameTestCases

It is also possible to configure replace_pattern parameter to find and replace a regex pattern. Use replace_to to set a replacement value. This configuration:

robocop format --select RenameTestCases -c RenameTestCases.replace_pattern=[A-Z]{3,}-\d{2,} -c RenameTestCases.replace_to=foo
[tool.robocop.format]
select = [
    "RenameTestCases"
]
configure = [
    "RenameTestCases.replace_pattern=[A-Z]{3,}-\\d{2,}",
    "RenameTestCases.replace_to=foo"
]

replaces all occurrences of a given pattern with string 'foo':

*** Test Cases ***
test ABC-123
    No Operation
*** Test Cases ***
Test foo
    No Operation

Capitalize each word

If you set capitalize_each_word to True it will capitalize each word in the test case name:

robocop format --select RenameTestCases -c RenameTestCases.capitalize_each_word=True
[tool.robocop.format]
select = [
    "RenameTestCases"
]
configure = [
    "RenameTestCases.capitalize_each_word=True"
]

will result in:

*** Test Cases ***
compare XML with json
    No Operation
*** Test Cases ***
Compare XML With Json
    No Operation