1. Tags

功能强大,个性化跑测试用例

robot -i smoke -e nrun ./

 

2. 罗列testcase
from robot.running import TestSuiteBuilder
from robot.model import SuiteVisitor


class TestCasesFinder(SuiteVisitor):
    def __init__(self):
        self.tests = []

    def visit_test(self, test):
        # print(dir(test))
        if(len(test.tags)) != 0:
            print(test.tags)
            print(test.longname)
            print(test.name)

        self.tests.append(test)

builder = TestSuiteBuilder()
testsuite = builder.build('./')
finder = TestCasesFinder()
testsuite.visit(finder)

print(*finder.tests)
print(len(finder.tests))

 

开源永流传