Getting rid of copying test suites into multiple parent suites


I currently maintain a hierarchical test suite structure like so:

├── __init__.robot
├── access_own_repository
│   ├── __init__.robot
│   └── read_write_permission_testcases.robot
├── __init__.robot
├── access_UserA_repository
│   ├── __init__.robot
│   └── read_write_permission_testcases.robot

The content of the read_write_permission_testcases files are identical and redundant. What’s more, I would like to keep them in sync, i.e. changing one of the files should immediately update the other one too and vice versa. Currently, I have to re-copy the file every time I am making changes.

Hard linking both files is not an option, as hard links are not recognized by git. The hard link would only exist on my machine.

I was experimenting with using symbolic links instead, but it seems that Robot Framework does ignore symbolic links.

Is there a recommended alternative approach, with which I could get rid of having to maintain multiple files for what’s effectively one?

Thank you,

You can make a common resource file with keywords and tests that apply to both suites.
Then just load it on suite init.

Hi Lev, thanks for the reply! If I understand correctly then exactly that is not possible.

The only way I am aware of to load a resource file is via the Resource setting in the Settings section. However, the Robot Framework User Guide mentions that

The higher-level structure of resource files is the same as that of test case files otherwise, but, of course, they cannot contain Test Case sections.

I googled a bit and found that my question was answered already 9 years ago actually:

I wondered if a more modern approach nowadays could make use of the –prerunmodifier option instead? I would like to avoid complex batch scripts and merging of the results. In the User Guide there is already an example about selecting every Xth test in a suite, would it be possible to also import tests from other suites with a similar approach? How could that look like?

Thanks in advance,

Sorry, i’ve forgot to mention that you should use test templates in common resource file.
Thus no test section, only keywords.

Thank you for the suggestion. As far as I understand, with that approach, at a minimum, I would still be required to duplicate the test case files containing the arguments to the templated test.

Note also that even though the example above was only with test suite files, I am actually copying even nested test suites sometimes, i.e. directories containing multiple test suite files/subdirectories.