Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Closed
pekkaklarck opened this issue Jan 3, 2023 · 3 comments
Closed

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

pekkaklarck opened this issue Jan 3, 2023 · 3 comments
Labels
acknowledge To be acknowledged in release notes beta 1 effort: medium enhancement good first issue Good for newcomers pr Pull request exists priority: medium
Milestone

Comments

@pekkaklarck
Copy link
Member

pekkaklarck commented Jan 3, 2023

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!

@pekkaklarck pekkaklarck added enhancement priority: medium acknowledge To be acknowledged in release notes labels Jan 3, 2023
@pekkaklarck pekkaklarck added this to the v6.1 milestone Jan 3, 2023
@pekkaklarck pekkaklarck added good first issue Good for newcomers and removed acknowledge To be acknowledged in release notes labels Jan 3, 2023
otemek pushed a commit to otemek/robotframework that referenced this issue Feb 9, 2023
otemek pushed a commit to otemek/robotframework that referenced this issue Feb 16, 2023
otemek pushed a commit to otemek/robotframework that referenced this issue Feb 16, 2023
otemek pushed a commit to otemek/robotframework that referenced this issue Feb 17, 2023
change suite names relative to atest root folder
@pekkaklarck
Copy link
Member Author

There's PR #4661 implementing this functionality.

@pekkaklarck
Copy link
Member Author

pekkaklarck commented Mar 14, 2023

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.

@pekkaklarck pekkaklarck added the pr Pull request exists label Mar 14, 2023
pekkaklarck pushed a commit to otemek/robotframework that referenced this issue Apr 4, 2023
pekkaklarck pushed a commit to otemek/robotframework that referenced this issue Apr 4, 2023
pekkaklarck pushed a commit to otemek/robotframework that referenced this issue Apr 4, 2023
pekkaklarck pushed a commit to otemek/robotframework that referenced this issue Apr 4, 2023
change suite names relative to atest root folder
pekkaklarck added a commit that referenced this issue Apr 4, 2023
Makes it possible to specify a custom name for suites.

Implements #4583, but documentation is still missing and some tests for invalid `Name` usage should also be added.

Co-authored-by: tom bsc <[email protected]>
Co-authored-by: Pekka Klärck <[email protected]>
@pekkaklarck pekkaklarck added acknowledge To be acknowledged in release notes effort: medium and removed effort: small labels Apr 4, 2023
pekkaklarck added a commit that referenced this issue Apr 4, 2023
@pekkaklarck
Copy link
Member Author

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

pekkaklarck added a commit that referenced this issue Apr 5, 2023
- Explain their usage and how they work together better.
- Explain that new Name is not compatible with --suite (#4583)
- Explain how --suite is going to be changed (incl. fixing of the
  above issue) in RF 7.0 (#4720, #4721, #4688)
pekkaklarck added a commit that referenced this issue Jun 1, 2023
Localization added to cs, nl, de, pt-BT, pt and sv.
pekkaklarck added a commit that referenced this issue Jun 2, 2023
Localization added to fr, es, ro and it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledge To be acknowledged in release notes beta 1 effort: medium enhancement good first issue Good for newcomers pr Pull request exists priority: medium
Projects
None yet
Development

No branches or pull requests

2 participants