Skip to content

The ResourceFile class

boakley edited this page Dec 31, 2014 · 2 revisions

When a resource rule is run, the rule is passed an instance of the ResourceFile class. Note: this class is used instead of SuiteFile when the file does not contain a testcase table.

The class represents the resource file being processed. It has the following attributes and methods:

  • name contains the name of the resource file.

  • tables is a list of RobotTable objects representing the tables in the suite (tables are the standard sections like ** Setup **, ** Keywords **, etc.) It also includes all non-standard tables that are normally ignored by robot (eg: any section that begins with one or more asterisks, but is following by something other than a standard robot section name, such as ** comment **). Such tables are completely ignored with standard robot parsing, but these tables are made available to rflint so that you can write rules against them. Each object in the list will be of one of the following types from rflint.parser.tables: UnknownTable, SettingTable, MetadataTable, VariableTable, TestcaseTable, or KeywordTable.

  • rows is a list of Row objects. A Row object is simply a list of each cell in a line of text in a robot file. Essentially it is the raw text but split into cells by the standard robot parsing rules (multiple spaces, tab, or pipe). In addition to the parsed data, a row object also records the line number from the file.

  • type will be set to "suite", "resource" or the special python value None.

  • keywords is a generator that returns a Keyword object representing each of the keywords defined in the file.

  • path is the fully qualified path to the file being processed

  • raw_text is the raw UTF8 text that was read from the file, prior to any parsing or manipulation