Skip to content

Alternative *.robot extension for test data in plain text files #1018

Closed

Description

@spooning

Originally submitted to Google Code by bryan.oakley on 27 Dec 2011

Robot uses the ".txt" extension for plain text files. This choice is problematic when implementing some sort of editor or IDE for test suite files. For example, if I want my users to be able to double-click on a test suite file to start the editor, I have to register RIDE or some other program with the suffix ".txt". This causes problems because I then cannot double-click on README.txt to open it up in a plain text editor (or, of course, any of the other myriad .txt files on my disk)

Robot needs its own unique suffix IMO. I recommend .rxt or .rf, though almost anything would be better than .txt. Other ideas: .rts (Robot Test Suite), .psv (Pipe-Separated Values). It will be hard to find one that isn't used somewhere, but at least we could pick one that isn't used everywhere.

The goal is to pick one that isn't likely used by a program that is also used by someone writing robot tests. For example, .rf was used by FrameMaker, but probably nobody who uses robot also uses framemaker so it's probably safe to use.

Activity

  1. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @mkorpela on 27 Dec 2011

    Question is: How to do this without breaking all the test data that RF users have?

  2. added this to the 2.7.6 milestone on Jun 29, 2014
  3. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by bryan.oakley on 27 Dec 2011

    It wouldn't break anything. I'm not suggesting that support for .txt be removed, only that support for some other extension is added. I should have made that more clear. What I"m really asking for is that we add some new suffix to the list of suffixes the robot parser uses to locate test files.

    If I point pybot at a directory, it only looks for a specific set of suffixes when looking for nested test suite files. I simply want that set to be expanded to include another suffix.

  4. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @mkorpela on 27 Dec 2011

    I'm suggesting that '.txt' will be deprecate if a new suffix will be added :)
    In my opinion '.txt' it self is the problem as pointed out in the original issue description.

    Remove '.txt'
    Have one major release with '.txt' and '.rxt' both supported and a deprecation warning about '.txt'
    Sleep N Months
    Have a second major release without '.txt' (complain if someone tries to run a '.txt' file)

  5. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by bryan.oakley on 27 Dec 2011

    I think it would be bad to remove support for .txtThere's already a precedent for multiple suffixes for the same file type: .rst and .rest both are for reStructuredText, and .htm, .html and .xhtml are for html.

    Supporting .txt isn't really the problem, only supporting .txt is the real problem. If there were another suffix that robot looked for in addition to ones it currently does the problem will be solved.

    I humbly suggest that if you want to deprecate .txt, make that a separate issue that can be tracked and voted on separately. Don't let the deprecation issue be a roadblock for adding another supported suffix for plain text files.

  6. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @mkorpela on 27 Dec 2011

    (This issue needs to be discussed with the whole core team. My opinions are my opinions and others are on Christmas holiday)

    But I think that if we leave .txt and add another similar .rxt (or something) we could end up into new kinds of problems when people mix these two suffixes (for example in the directory pointing case). Mainly to problems where some suites are not executed if they have the other suffix.

    I think that if robot would look for both suffixes, your original problem would not be solved completely. We would still need to somehow make .rxt the 'de facto' robot format. Old third party tools and builds could also do stuff wrong without anyone noticing it. It would also make it more error prone to build new tools if we support yet another suffix.

    Could there be some other solutions to the original problem?

    For example: could you register a subset of .txt files .. like '.robot.txt'?

  7. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by bryan.oakley on 28 Dec 2011

    You seem to be making this problem much bigger than it is. All I want is another suffix besides .txt to choose from for pipe delimited files. This new suffix doesn't have to be the "de facto" robot format.

    All I want is a) for robot to parse and run these files when fed to it, and b) to find these files when it loads all the tests in a directory. Nothing more. Like I said earlier, there's already a precedent for supporting multiple suffixes for the same file format so this isn't breaking any new ground.

    As to your concern that my original problem won't be solved just by adding a new suffix, I assure you it would. My problem is simply that I don't want to use .txt for pipe-separated files. Giving me another choice solves that problem.

  8. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 30 Dec 2011

    1. I think this is a good idea. I have actually been thinking about this myself few times earlier. There are some open questions discussed in points below that needs to be answered before this can be implemented, though.

    2. I don't think support for .txt extension should be removed because:

    a) I doubt having multiple extensions for plain text files would cause big problems in practice. At least there hasn't been too many problems of HTML files supporting .html, .htm and .xhtml, reST files supporting .rst and .rest, and in general being able to have files 'tests.txt', 'tests.html', 'tests.tsv' in same directory.

    b) It is often very handy, especially for new users, that you can open .txt files in Notepad, browsers know how to view them, etc.

    c) It would simply be too backwards incompatible change.

    1. I can understand that if someone decides to use only certain file type with test data files, it would be nice if other files would be excluded. That is a generic and already existing problem not related to this issue, though. The biggest problem related to this would actually be parsing all HTML files (including logs and reports) expecting them to contain test data. A solution I have been thinking for this problem is having an option like '--excludefiles' that tells Robot to ignore certain files altogether. You could use that, for example, like --excludefiles *.txt or --excludefiles *_resource.*. A separate issue can be submitted about this.

    2. If we decide to add a new Robot specific extension, we have a possibility to add separate extensions for test suites (e.g. .rfs) and resource files (e.g. .rfr). That would help, for example, RIDE to recognize file type without parsing the data. I'm not sure is this worth the slightly added complexity, but this needs to be decided before adding a new extension. Changing this afterwards would be too much backwards incompatible.

    3. We could potentially also add separate extension for test data in HTML format. In that case having separate extensions also for suites and resources would probably be too much.

  9. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by bryan.oakley on 2 Feb 2012

    Can we add this to 2.7, please?

    I would be happy to submit a patch for the change and a few tests, though I need a tiny bit of guidance. After just a cursory glance it seems like all it takes is to add a new suffix in the READERS dict in robot/parsing/populators, though this is where the guidance comes in -- maybe you guys know of other places in the code where suffixes are hard-coded.

    All I need to get started is for a decision to be made on the suffix. I recommend one of ".rbt", ".rxt" or ".rf", none of which appear in the wikipedia page on file formats [1]. That's not exactly an exhaustive list, but it does have the few hundred most common suffixes.

    [1] http://en.wikipedia.org/wiki/List_of_file_formats

  10. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by bryan.oakley on 7 Feb 2012

    I've attached a patch that adds ".rbt" as another suffix for the plain text format. This patch includes one small code enhancement, changes to two pages in the user guide, and the addition of some new acceptance tests.

    Output of 'hg stat':

    M atest\robot\parsing\data_formats\formats_resource.txt
    M doc\userguide\src\CreatingTestData\CreatingTestSuites.txt
    M doc\userguide\src\CreatingTestData\TestDataSyntax.txt
    M src\robot\parsing\populators.py
    A atest\robot\parsing\data_formats\rbt.txt
    A atest\testdata\parsing\data_formats\rbt\empty.rbt
    A atest\testdata\parsing\data_formats\rbt\invalid.rbt
    A atest\testdata\parsing\data_formats\rbt\sample.rbt
    A atest\testdata\parsing\data_formats\rbt\with_init__init__.rbt
    A atest\testdata\parsing\data_formats\rbt\with_init\sub_suite1.rbt
    A atest\testdata\parsing\data_formats\rbt\with_init\sub_suite2.rbt
    A atest\testdata\parsing\data_formats\resources\rbt_resource.rbt
    A atest\testdata\parsing\data_formats\resources\rbt_resource2.rbt

    I don't guarantee this is perfect, but as the saying goes: "it works for me".

    If you wish to use this code, I hereby assign all ownership and copyright to the custodians of this project.

  11. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by bryan.oakley on 23 Mar 2012

    Can someone add a note as to whether this will be in 2.8 or not?

  12. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 26 Mar 2012

    I think this is a valid enhancement for 2.8. I cannot, obviously, make any promises will it actually make it there, when such a release will be made, etc. I anyway tentatively target this for 2.8.

    What we should try to agree already now is what extensions to use. I've been thinking this a bit more and feel that following points, discussed more thoroughly on my comment 7 (testing auto-linking: comment #7 c7 #c7):

    1. Test cases files and resource files should have separate extension. That makes parsing slightly faster as resource files can be ignored when parsing test cases. Init files can have same extension as test case files as they anyway have a recognizable body. The extensions could be, for example, in format like '.??t' and '.??r'.

    2. It should be possible to have separate alternative extensions for data in HTML format and perhaps also for TSV. There's no need to implement them immediately, but we need to take that into account.

    With the above restrictions, the extensions for plain text test case and resource files could be, for example, '.rtt' and '.rtr'. We could then later, if needed, use '.rht' and '.rhr' with HTML data. These extensions don't seem to be used by any major applications.

    Another good possibility is '.rftt/.rftr' and '.rfht/.rfhr'. If we consider plain text format the default and recommended format, we could also use '.rft/.rfr' for plain text and, for example, '.rfh/.rfs' for HTML.

  13. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by imranoftherings on 21 May 2012

    Can we make this configurable?

    We have 2 projects which use RF and we would like both of them to have unique extensions. Mostly to be able to support different syntax highlighting between the two. Maybe add a commandline parameter

    --extension txt:test:abcd|txt:resource:efgh|html:test:hijk|html:resource:lmno

    This basically says that

    'abcd' extension maps to a 'txt' Test
    'hijk' extension maps to a 'html' Test
    'efgh' extension maps to a 'txt' Resource
    'lmno' extension maps to a 'html' Resource

  14. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by bryan.oakley on 21 May 2012

    I would vote against this. It is not a generally useful construct IMO, and would make the implementation more complex and thus more likely to have bugs and less likely to ever get implemented.

    The feature request already has major scope-creep, from "change .txt to something else" to "give text files and resources different extensions". I'd rather not see this feature get even more bloated.

    Simpler is better.

  15. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 26 Nov 2012

    Ok, let's get an alternative extension for plain text files into the next release. I'll discuss with other devs would having a separate extension for resource files help with RIDE and other tools that introducing it would make sense.

    Alternative extensions for other file types can be added later if there are needs. If issue 1283 is implemented, users can also add custom extensions themselves.

  16. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 28 Nov 2012

    It seems that LEGO Mindstrom uses .rbt extension so there is a potential conflict:
    http://www.fileinfo.com/extension/rbt

    Is there a reason we couldn't use even more explicit .robot extension?

  17. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 30 Dec 2012

    Decisions have finally been made:

    1. Only add alternative extension for plain text files (at least at this point).
    2. No separate extension for resource files.
    3. The new extension is *.robot.
  18. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 30 Dec 2012

    This issue was updated by revision d31c3d7d312e.

    Support for new *.robot extension added (that was trivial) and also tests created based on tests for *.txt.

    Todo:

    1. Document the new extension in User Guide. This is a must.
    2. Enhance Tidy to handle this new extension/format too. Not mandatory for 2.7.6 but would be nice.
    3. Submit issue to RIDE about handling this extension.
    4. Enhance robotframeworklexer [1](including the version to be included into Pygments 1.6) to handle *.robot files.

    [1] https://bitbucket.org/pekkaklarck/robotframeworklexer

  19. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 30 Dec 2012

    This issue was updated by revision 66c0f45a1fe8.

    Now Tidy supports robot extension/format. Output is naturally the same as with txt, but the extension is different.

  20. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 1 Jan 2013

    This issue was updated by revision aa08dc0d57ed.

    The new extension is now mentioned in the UG. Need to think should it be somehow shown also in --help text.

  21. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 1 Jan 2013

    This issue was updated by revision 2200c4806796.

    Now new *.robot extension is shown in an example also in --help text. Other formats aren't explained any more than that either.

    I consider this issue now done.

  22. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 6 Jan 2013

    This is the issue to add support for *.robot files to RIDE:
    https://code.google.com/p/robotframework-ride/issues/detail?id=1182

  23. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 10 Jan 2013

    And here's finally a pull request to add *.robot support for Pygmetns:
    https://bitbucket.org/birkenfeld/pygments-main/pull-request/153/robot-framework-lexer-add-support-for/diff

    Hopefully the pull request still makes it into Pygments 1.6.

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions