Skip to content

Possibility to give a custom name to a suite using Name setting #4583

Closed

Description

@pekkaklarck

Suite names are got from file or directory names by default so that, for example, example_suite.robot creates a suite Example Suite. This works fine in general, but makes it inconvenient or even impossible to use special characters like ! or _. Longer suite names can also be inconvenient as file/directory names. An easy solution to allow using whatever names is adding a new Name. The name would still be set based on the file/directory name by default, but this new setting would allow overriding it.

In practice the new setting will look like this:

*** Settings ***
Name            Custom name!

Being able to set a custom name for suites like this would make issue #4015 more powerful. Without this you needed to use the --name option in addition to __init__.robot files to be able to fully configure the virtual top level suite created when executing multiple files/directories.

This change only affects parsing and is fairly straightforward. This is a good issue for anyone interested to get more familiar with Robot's parser!

Activity

  1. added
    acknowledge
    on Jan 3, 2023
  2. added this to the v6.1 milestone on Jan 3, 2023
  3. added
    good first issue
    and removed
    acknowledge
    on Jan 3, 2023
  4. added a commit that references this issue on Feb 9, 2023
  5. added 3 commits that reference this issue on Feb 16, 2023
  6. pekkaklarck commented on Mar 14, 2023

    @pekkaklarck
    MemberAuthor

    There's PR #4661 implementing this functionality.

  7. pekkaklarck commented on Mar 14, 2023

    @pekkaklarck
    MemberAuthor

    One problem with making it possible to customize the suite name like this is that it doesn't work properly with the --suite command line option. The reason is that the --suite option has performance optimization and it causes files not matching the specified suite not being parsed at all. Thus if you have file tests.robot that changes name to Example, using --suite Example won't work because Example doesn't match the file name and tests.robot isn't even parsed. On the other hand, --suite Tests won't work either because the filtering code is used also after parsing and Tests doesn't match the parsed suite name.

    The performance optimization with --suite is there for a reason and removing it wouldn't be a good idea unless there's some other way to limit parsing of files. I propose we do the following:

    1. In RF 6.1 add Name setting so that it doesn't work properly with --suite. This is unfortunate but we can document the behavior.
    2. In RF 6.2, or RF 6.1 if we have time, add separate command line option like --parsefiles or just --files that controls what files should be parsed. It should only look at the file names and it doesn't need to try to construct suite names from them like we do with --suite.
    3. In RF 7 change --suite so that it doesn't affect parsed files. After that Name and --suite work together as expected. Those who want to limit parsing to certain files can use the option added earlier instead of in addition to --suite.

    This issue obviously covers point 1 above. I'll submit separate issues for points 2 and 3.

  8. added
    pr
    on Mar 14, 2023
  9. added a commit that references this issue on Apr 4, 2023
  10. 3 remaining items

  11. added
    acknowledge
    and removed on Apr 4, 2023
  12. pekkaklarck commented on Apr 4, 2023

    @pekkaklarck
    MemberAuthor

    This was implemented in #4661 by @otemek. I added documentation and enhanced tests a bit in above commits. Thanks for contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgebeta 1effort: mediumgood first issueprpriority: medium

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions