0
votes

Is it possible to import only a specific set of keywords from a resource file.

Resource.robot

*** Keywords ***
Kw1
    Do something

Kw2
   Do something else

In the above example is it possible to import only Kw1 from Resource.robot?

The issue I'm facing is that I have 2 resource files that have certain keywords with the same name. And I need both the resource files for the test suite.

I'm aware that "resource_file_name.keyword_name" would work but it makes the test step not so easy to read.

1
In short - no, with RF syntax. It can be done with intermediate python methods, but it's a lot of hassle, compared to using a fully-qualified name. - Todor Minakov

1 Answers

1
votes

Is it possible to import only a specific set of keywords from a resource file.

No, it is not. You can only import entire resource files.

If your problem is that more than one resource file creates keywords with the same name, you have the following options:

  1. rename the keywords so that they are all unique
  2. fully qualify the keywords when you use them
  3. use Set Library Search Order from the BuiltIn library to tell robot which library or resource file has precedence when there is a conflict.