其他分享
首页 > 其他分享> > RobotFramework tags + 罗列testcase

RobotFramework tags + 罗列testcase

作者:互联网

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))

 

标签:tests,tags,self,robot,RobotFramework,testcase,print,test,finder
来源: https://www.cnblogs.com/flypig258/p/15458917.html