Skip to content

Support .resource extension with resource files #2891

Closed

Description

@pekkaklarck

It would sometimes be handy to be able to separate resource files from test case just by looking at the file name. We can easily accomplish that by allowing resource files to have a separate .resource extension. This would make it possible to do something like robot path/*.robot without worrying are there resource files in the same directory. It would also mean that we can name resource files like login.resource instead of login_resource.robot.

The idea of this proposal is not to remove or even deprecate the support to keep using .robot extension with resource files.

Even after this change test case files and test suite initialization files (__init__.robot) would still share the same extension. It's easy to separate initialization files due to their special basename, and the earlier example could be changed to robot path/[^_]*.robot to avoid them.

I've proposed this enhancement earlier on our Slack channel but there wasn't much interest. Since that this functionality would have been useful for me few times, and thus I plan to add this and do it already in RF 3.1. If there are objections, this decision can still be changed.

Activity

  1. added this to the v3.1 milestone on Jul 4, 2018
  2. boakley commented on Jul 4, 2018

    @boakley

    I'm pretty ambivalent to this change. However, I've found it's quite easy to determine whether a .robot file is a resource file or not. All you have to do is read the file and look for the absence of a test table, which just takes a few milliseconds.

    If the problem being solved is being able to do robot *.robot in a folder with both tests and resource files, wouldn't it be better to have the test runner simply ignore files that don't contain test tables?

  3. aaltat commented on Jul 4, 2018

    @aaltat
    Contributor

    If I would be starting a new project I would consider strongly to use this feature. Although it has some drawbacks, example with find . --name *.robot does not find me all the RF files, I think possibility to separate test and resources between extension is more useful. Therefore I am favour of the feature.

  4. pekkaklarck commented on Jul 4, 2018

    @pekkaklarck
    MemberAuthor

    @boakley Runner ignores files without test tables when you execute a directory, but when you run robot first.robot second.robot and_so_on.robot it expects all files to be test case files. That is by design, I think we changed that at some point, and I don't think it should be changed. Anyway, even if .resource would be supported, it didn't mean anyone needed to use it.

    @aaltat You could still use find . -name \*.robot -o -name \*.resource to find all RF files. Also, using find . -name \*.robot or find . -name \*.resource would find all test (and init) files or all resource files, respectively.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions