What are the benefits of using .robot files instead of .txt files for testing

Viewed 941

With robot framework's new version 3.1 .txt files by default aren't parsed and .robot files are. Overall, if I were to continue to use .txt files for testing with robot framework what will the downsides of that compared to using .robot files be? Besides having to use --extenstion .txt when running tests.

Essentially a comparison of .robot files and .txt files using robot framework.

1 Answers

I think it is an optimalization. Now, unless otherwise specified .robot files are the ones that contains test cases and the framework won't look into other ones. Time and effort spent on parsing resource files unnecessarily will be saved. With a huge test structure this can be significant amount.

An example, before RF 3.1 one could use .txt extension for resource files and .robot for test suites. This way it is transparent which files have actual tests and which ones are just resources.

Let's assume that there are a lot of test cases and the user wants to run everyone with a specific tag.

robot . --include NIGHTLY

Before RF 3.1 all of the files would have been parsed in search for NIGHTLY tag even though we know that there is no point in searching the .txt files.

With RF 3.1 .txt files and others (like the newly introduced .resource) will be skipped by default. Also in RF 3.1 we have a more explicit way to distinguish the resource files from the suite files with the new .resource extension.

So the main point with the different file extensions is that one can separate the files by different roles and can use different extensions for each. If you use .txt instead of .robot, that is fine. But if you use the same extension for test suites and resource files, you lose transparency and maybe performance.

Related