boakley edited this page Nov 30, 2014 · 2 revisions

(This documentation is woefully incomplete. I'm working on it.)

rflint is a simple static analysis tool for robotframework .txt, .tsv and .robot files in the plain text format (space separated, pipe-separated or tab-separated). It takes as input one or more files, and runs a set of rules against each file.

Rules are simple python classes with a single method, apply. Depending on the parent class, this method will be given a reference to a test suite object, a testcase object, or a keyword object. At the moment, rflint will only look for rules in the rules folder where rflint is installed.

Example rule that checks for duplicate testcase names within a suite:

import rflint.rule as rule

class DuplicateTestNames(rule.SuiteRule):
    '''Verify that no tests have a name of an existing test in the same suite'''
    severity = rule.ERROR

    def apply(self, suite):
        cache = []
        for testcase in suite.testcases:
            if name in cache:
                self.report(suite, testcase.linenumber, "Duplicate testcase name")