Repository navigation
Description
The .robot extension that was added in RF 2.7.6 (#1018) has been a great enhancement making it explicit that files contain Robot tests, not just random text. We should now go one step further and start parsing only .robot files by default.
Not parsing .txt files (nor .html and .tsv files, #2819) will make parsing data a bit faster, but lot more importantly it allows us to always make it an error when parsing a file fails. At the moment failures to open a file, for example, due to missing permission or incompatible encoding are totally ignored when executing a directory, because we just assume they don't contain test data. If we only parse .robot files, we know they should contain data for us and any problem working with these files is an error.
We cannot suddenly stop parsing .txt (and .rst and .html and .tsv) files in RF 3.1 because users wouldn't notice it otherwise but looking at the number of executed test cases. We should, however, deprecate using anything else than .robot in RF 3.1 and then stop parsing these files altogether in RF 3.2 or later.
Parsing only .robot files has few problems, though:
- Not possible to run tests embedded to reStructuredText files in a file like
example.rst. If extension is changed to.robot, editors don't open it correctly as a reST file. - Not possible to run test data in TSV format (e.g.
example.tsv) even if it would be compatible with the plain text format (Deprecate using test data in HTML and TSV formats #2819). If extension is changed to.robot, spreadsheet programs don't know how to open it. - Some users may have real needs to keep using the
.txtextension.
A solution to these problems is allowing users to use the --extension option to tell which extensions to parse. This option was added in RF 3.0.1 (#2365) to control which files to parse with a plan to use it also later if/when only .robot files are parsed by default. In practice this option could be used like --extension txt to parse only .txt files or like --extension robot:rst to parse .robot and .rst files.
Another possible solution would be allowing files to use format like example.robot.rst. This has the benefit of not needing a separate command line option, but the name is also somewhat ugly. This can be considered if users consider it useful.
Activity
[-]Parse only `.robot` files by default[/-][+]Deprecate parsing other than `.robot` files[/+]Deprecate using other than *.robot files.
pekkaklarck commentedon Jun 27, 2018
This is now mostly done. If a file not having
*.robotextension contains data, there is a warning about it telling that--extensionneeds to be used in the future (and also now to avoid the warning). An exception to this is HTML files because support for them is going to be removed for good (#2819) and there is a separate warning when parsing them.Things to do:
*.robotextension. At the moment there is not warning whatsoever. We could say that's fine because the point with this issue is avoiding non-data files when scanning directories for test data, but somehow it would still feel pretty inconsistent.Document current support data formats.
pekkaklarck commentedon Jul 5, 2018
This issue can be considered done.