You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support .resource extension with resource files #2891
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.
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?
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.
@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.
Activity
boakley commentedon Jul 4, 2018
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 *.robotin 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?aaltat commentedon Jul 4, 2018
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 *.robotdoes 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.pekkaklarck commentedon Jul 4, 2018
@boakley Runner ignores files without test tables when you execute a directory, but when you run
robot first.robot second.robot and_so_on.robotit 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.resourcewould be supported, it didn't mean anyone needed to use it.@aaltat You could still use
find . -name \*.robot -o -name \*.resourceto find all RF files. Also, usingfind . -name \*.robotorfind . -name \*.resourcewould find all test (and init) files or all resource files, respectively.