Skip to content

Deprecate parsing other than .robot files #2820

Closed

Description

@pekkaklarck

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 .txt extension.

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

  1. added this to the v3.1 milestone on Apr 26, 2018
  2. changed the title [-]Parse only `.robot` files by default[/-] [+]Deprecate parsing other than `.robot` files[/+] on Jun 8, 2018
  3. pekkaklarck commented on Jun 27, 2018

    @pekkaklarck
    MemberAuthor

    This is now mostly done. If a file not having *.robot extension contains data, there is a warning about it telling that --extension needs 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:

    • Consider how to handle resource files using other than *.robot extension. 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.
    • Update User Guide.
  4. pekkaklarck commented on Jul 5, 2018

    @pekkaklarck
    MemberAuthor
    • Decided not to emit warnings if other than non-robot files are used as resource files.
    • User Guide has been updated.

    This issue can be considered done.

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